pub trait Chained: Resource {
type Base: Resource;
// Required methods
fn chain() -> RecordId;
fn part_for(
action: &Self::Action,
parts: &[(u64, Rc<Self::State>)],
) -> Result<u64, String>;
// Provided methods
fn chain_beside(base: &RecordId) -> RecordId { ... }
fn prepare(
action: &mut Self::Action,
base: &<Self::Base as Resource>::State,
) -> Result<(), String> { ... }
fn carry(previous: u64, part: &Self::State) -> Option<Invoke<Self>> { ... }
fn place(
action: &Self::Action,
base: &<Self::Base as Resource>::State,
) -> Option<String> { ... }
}Expand description
A resource whose records are the parts of a chain kept beside the app’s
own record (RecordId::part). See the module docs.
Required Associated Types§
Sourcetype Base: Resource
type Base: Resource
The app’s own resource: what Self::prepare reads where an action
is invoked.
Required Methods§
Provided Methods§
Sourcefn chain_beside(base: &RecordId) -> RecordId
fn chain_beside(base: &RecordId) -> RecordId
The chain that belongs beside base rather than beside the app’s own
record: the messages of one conversation, kept beside its record
(RecordId::of_direct). Self::chain for every chain there is
only one of.
Sourcefn prepare(
action: &mut Self::Action,
base: &<Self::Base as Resource>::State,
) -> Result<(), String>
fn prepare( action: &mut Self::Action, base: &<Self::Base as Resource>::State, ) -> Result<(), String>
Fill in, where the action is invoked, what it records from the app’s own record (who a mention names), and refuse what that record does not allow (a post to a channel it has not got). A part’s action itself reads only its part, so it replays the same on every replica.
Sourcefn carry(previous: u64, part: &Self::State) -> Option<Invoke<Self>>
fn carry(previous: u64, part: &Self::State) -> Option<Invoke<Self>>
What a part started after part previous (whose state is part)
carries of the parts before it, written into it as it starts, before
the action that started it: a summary a reader needs of parts it
does not hold (a chat’s message counts for unread badges). Whoever
starts a part holds the one before. None carries nothing.
Sourcefn place(
action: &Self::Action,
base: &<Self::Base as Resource>::State,
) -> Option<String>
fn place( action: &Self::Action, base: &<Self::Base as Resource>::State, ) -> Option<String>
Where in the app’s own record action happens, named as everyone
the record is shared with sees that place (a post’s channel,
#general): history keeps it on the step
(tilo_actions::PLACE_FACET), so what someone is doing can say
where. None for an action of no such place, and for a place not
everyone sees (a direct conversation).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.