pub struct SessionBuilder { /* private fields */ }Expand description
Builder struct for creating a Session instance step-by-step.
The SessionBuilder allows you to configure and create a Session by
specifying the necessary configuration and request handles.
Implementations§
Source§impl SessionBuilder
Builder for constructing a Session instance.
impl SessionBuilder
Builder for constructing a Session instance.
The SessionBuilder is used to incrementally construct a Session object, allowing for the
configuration of various parameters before finalizing the session. It provides a flexible way
to build and configure a Session by setting different attributes such as configuration,
user-specific data, or other relevant parameters required for session management.
The builder pattern allows for creating a Session with multiple optional components in a
controlled manner, without forcing users to provide all attributes at once.
§Example:
let session = SessionBuilder::new()
.with_config(config)
.with_user_info(user_info)
.build();Sourcepub fn with_config(self, config: Config) -> Self
pub fn with_config(self, config: Config) -> Self
Sourcepub fn with_handles(self, handles: Handles) -> Self
pub fn with_handles(self, handles: Handles) -> Self
Sourcepub fn build(self) -> Result<Session, Error>
pub fn build(self) -> Result<Session, Error>
Builds the final Session object.
This method checks if all required fields have been provided and creates
the Session instance. If any required fields are missing, an error is returned.
§Returns
Ok(Session): The successfully builtSession.Err(error::Error): An error if required fields are missing.
Auto Trait Implementations§
impl Freeze for SessionBuilder
impl RefUnwindSafe for SessionBuilder
impl Send for SessionBuilder
impl Sync for SessionBuilder
impl Unpin for SessionBuilder
impl UnwindSafe for SessionBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request