pub struct UserBuilder { /* private fields */ }Expand description
User context builder (Builder Pattern).
Responsibilities:
Constructs UserContext objects with support for chained calls.
Implementations§
Source§impl UserBuilder
impl UserBuilder
Sourcepub fn new(id: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, name: impl Into<String>) -> Self
Initializes the builder.
Required parameters: User ID and Username.
Sourcepub fn meta<V: Serialize>(self, key: &str, value: V) -> Self
pub fn meta<V: Serialize>(self, key: &str, value: V) -> Self
Adds a metadata key-value pair.
If value fails to serialize, the field will be silently ignored.
Sourcepub fn build(self) -> UserContext
pub fn build(self) -> UserContext
Builds the UserContext.
The result contains the serialized metadata JSON string.
Auto Trait Implementations§
impl Freeze for UserBuilder
impl RefUnwindSafe for UserBuilder
impl Send for UserBuilder
impl Sync for UserBuilder
impl Unpin for UserBuilder
impl UnwindSafe for UserBuilder
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
Mutably borrows from an owned value. Read more