pub struct IdBuilder {
pub hash: Encryption,
/* private fields */
}Expand description
IdBuilder is the constructor for the HWID. It can be used with the 3 different options of the Encryption enum.
Fields§
§hash: EncryptionImplementations§
Source§impl IdBuilder
impl IdBuilder
Sourcepub fn build(&mut self, key: &str) -> Result<String, HWIDError>
pub fn build(&mut self, key: &str) -> Result<String, HWIDError>
Joins every part together and returns a Result that may be the hashed HWID or a HWIDError.
§Errors
Returns Err if there is an error while retrieving the component’s strings.
§Examples
use machineid_rs::{IdBuilder, Encryption, HWIDComponent};
let mut builder = IdBuilder::new(Encryption::MD5);
builder.add_component(HWIDComponent::SystemID);
// Will panic if there is an error when the components return his values.
let key = builder.build("mykey").unwrap();Sourcepub fn add_component(&mut self, component: HWIDComponent) -> &mut Self
pub fn add_component(&mut self, component: HWIDComponent) -> &mut Self
Adds a component to the IdBuilder that will be hashed once you call the IdBuilder::build function.
You can’t add the same component twice.
§Examples
use machineid_rs::{IdBuilder, Encryption, HWIDComponent};
let mut builder = IdBuilder::new(Encryption::MD5);
builder.add_component(HWIDComponent::SystemID);Sourcepub fn new(hash: Encryption) -> Self
pub fn new(hash: Encryption) -> Self
Makes a new IdBuilder with the selected Encryption
§Examples
use machineid_rs::{IdBuilder, Encryption};
let mut builder = IdBuilder::new(Encryption::MD5);Auto Trait Implementations§
impl Freeze for IdBuilder
impl RefUnwindSafe for IdBuilder
impl Send for IdBuilder
impl Sync for IdBuilder
impl Unpin for IdBuilder
impl UnwindSafe for IdBuilder
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