aboutsummaryrefslogtreecommitdiffstats
path: root/src/access/policy.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-29 03:21:43 +0000
committertv <tv@krebsco.de>2026-11-29 03:21:43 +0000
commite63d30c2581033a85489b10c3f5b252fdbb5049e (patch)
tree5f4e6f65f1cecfb32f841e7ad7d9d106aeb69b20 /src/access/policy.rs
parent9188fa6e13ea7facfab5fb6f55bf26444ec2c01e (diff)
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).
Diffstat (limited to 'src/access/policy.rs')
-rw-r--r--src/access/policy.rs4
1 files changed, 2 insertions, 2 deletions
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<Policy, String> {
/// 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)