pub struct IdentifierTypeDataBuilder { /* private fields */ }
Expand description
A helper struct for building IdentifierTypeData objects.
Implementations§
Source§impl IdentifierTypeDataBuilder
impl IdentifierTypeDataBuilder
Sourcepub fn new(identifier: IdentifierType) -> Self
pub fn new(identifier: IdentifierType) -> Self
Sourcepub fn add<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self
pub fn add<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self
Adds a key-value pair to the IdentifierTypeDataBuilder object.
§Examples
use uniqueid::IdentifierTypeDataBuilder;
use uniqueid::IdentifierType;
let mut builder = IdentifierTypeDataBuilder::new(IdentifierType::CPU);
builder.add("key", "value");
§Panics
Panics if the IdentifierTypeDataBuilder object is empty.
Sourcepub fn build(self) -> String
pub fn build(self) -> String
Builds the IdentifierTypeData object into a string.
§Examples
use uniqueid::IdentifierTypeDataBuilder;
use uniqueid::IdentifierType;
let mut builder = IdentifierTypeDataBuilder::new(IdentifierType::CPU);
builder.add("key", "value");
assert_eq!(builder.build(), "CPU(key=value)");
Auto Trait Implementations§
impl Freeze for IdentifierTypeDataBuilder
impl RefUnwindSafe for IdentifierTypeDataBuilder
impl Send for IdentifierTypeDataBuilder
impl Sync for IdentifierTypeDataBuilder
impl Unpin for IdentifierTypeDataBuilder
impl UnwindSafe for IdentifierTypeDataBuilder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more