Skip to main content

StreamState

Enum StreamState 

Source
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

Source§

fn clone(&self) -> StreamState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StreamState

Source§

impl Debug for StreamState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for StreamState

Source§

impl PartialEq for StreamState

Source§

fn eq(&self, other: &StreamState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StreamState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.