Enum ldap3::StreamState[][src]

pub enum StreamState {
    Fresh,
    Active,
    Done,
    Closed,
    Error,
}

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

impl Clone for StreamState[src]

impl Copy for StreamState[src]

impl Debug for StreamState[src]

impl Eq for StreamState[src]

impl PartialEq<StreamState> for StreamState[src]

impl StructuralEq for StreamState[src]

impl StructuralPartialEq for StreamState[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.