pub enum StreamState {
Fresh,
Active,
Done,
Closed,
Error,
}Expand description
Possible states of a SearchStream.
§SearchStream call/state conceptual diagram
Columns depict method call chains. The Inner row is the final call destination for all stream variants. At the bottom of each column is the expected state before the call to a method. Numbers in call site boxes are the points of state transitions.
SearchStream has two variants, direct and adapted, differentiated by the size of
the adapter vector. The direct version, with an empty vector, is the regular one;
the adapted version passes each method call through a chain of adapters before executing
the direct call. In the diagram, direct calls start from the top of the column, while adapted
calls start at the bottom.
Every SearchStream is created in the Fresh state, and the start() method is automatically
called. The start() method, although publicly visible so that adapter chaining can work, is
not meant for calls from user code. It will change the state from Fresh to Active at point (1),
when the protocol request is successfully written to the network socket. Any error in submitting
the request will change the state to Error. Calling start() in any state but Fresh will just
immediately return.
Iterating through the stream with next() requires the Active state, which turns into Done
when the final Search message is received. However, the transition must not be made in the
inner method, since the adapters may need to keep providing additional entries even when
the original operation is over. Therefore, point (2) occurs at the end of the first call
in the chain (for the adapted streams), or in the shim method (for the direct ones). As before,
any error will result in the Error state.
The finish() method may be called at any time. Adapters along the way can behave differently
according to the state, and the final direct call will change the state to Closed at (3). Calling
finish() on a stream in the Closed state will return a synthetic error-bearing LdapResult.
Variants§
Fresh
Stream which hasn’t yet been initialized in start().
Active
Initialized stream which can be iterated through with next().
Done
Stream from which all entries have been retrieved.
Closed
Properly finalized stream on which finish() was called.
Error
Stream in an error state after some fallible operation.
Trait Implementations§
Source§impl Clone for StreamState
impl Clone for StreamState
Source§fn clone(&self) -> StreamState
fn clone(&self) -> StreamState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StreamState
Source§impl Debug for StreamState
impl Debug for StreamState
impl Eq for StreamState
Source§impl PartialEq for StreamState
impl PartialEq for StreamState
Source§fn eq(&self, other: &StreamState) -> bool
fn eq(&self, other: &StreamState) -> bool
self and other values to be equal, and is used by ==.