From e63d30c2581033a85489b10c3f5b252fdbb5049e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 Nov 2026 03:21:43 +0000 Subject: state: plain writes take a view to write, Automerge's are asked for as such AppState::mutate_doc, mutate_doc_registering and mutate_doc_by hand what they are given a document::view::Write: the member registry, the users, sessions, forgetting and bootstrap write through them, and take whatever kind of document gives it. AppState::mutate_doc_for is for what asks more of an Automerge document than values at paths (the store's API, a remake's host, a store's events), and gives the heads after the write. What reads a view takes one of any size (dyn Write among them). --- src/access/policy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/access/policy.rs') diff --git a/src/access/policy.rs b/src/access/policy.rs index e4027b8..e596175 100644 --- a/src/access/policy.rs +++ b/src/access/policy.rs @@ -119,7 +119,7 @@ pub(crate) fn as_written(value: &JsonValue) -> Result { /// where its `store` is, as continuum writes them: an Automerge text there, or one holding /// the policy, reads as a string in plain JSON, so a policy that would read so only /// through a text is one nobody knows, never what its characters spell. -pub(crate) fn of(doc: &impl Read) -> Policy { +pub(crate) fn of(doc: &(impl Read + ?Sized)) -> Policy { match view::read_plain(doc, &path()) { Ok(Some(value)) => match read(&value) { policy if policy.strict() && !a_string(doc, "values") => { @@ -138,7 +138,7 @@ pub(crate) fn of(doc: &impl Read) -> Policy { /// Whether the policy `doc` holds, read in typed JSON (where a text is tagged, and an /// envelope reads as its payload), has a string for its `key`. -fn a_string(doc: &impl Read, key: &str) -> bool { +fn a_string(doc: &(impl Read + ?Sized), key: &str) -> bool { matches!( doc.read_typed(&path()), Ok(Some(value)) if value.get(key).is_some_and(JsonValue::is_string) -- cgit v1.3.1