pub struct WriteState { /* private fields */ }Expand description
Whether the destination refuses changes of its own accord.
The answer is read once per invocation and kept, because it cannot change while one connection is open. It is never read for a statement that only reads, since a read-only destination serves a read perfectly well.
A caller who asked for the destination to be consulted before every change gets exactly that: the kept answer is discarded first, so the next reading is the destination’s and not the memory of it.
Implementations§
Source§impl WriteState
impl WriteState
Sourcepub const fn new(probe: ReadOnlyProbe) -> Self
pub const fn new(probe: ReadOnlyProbe) -> Self
Starts a state that asks the destination as often as the caller wants.
Sourcepub fn admit(&mut self, server_read_only: bool) -> Result<()>
pub fn admit(&mut self, server_read_only: bool) -> Result<()>
Records what the destination said about itself and answers from then on.
The refusal names the destination’s own mode rather than the permission failure the server would eventually produce, because the caller’s next step is to point somewhere else and not to ask for a right.
§Errors
Returns a validation failure when the destination accepts no change.
Sourcepub const fn was_checked(&self) -> bool
pub const fn was_checked(&self) -> bool
Whether the destination has been consulted yet.
Exposed so a test can show the answer is read once and then reused.