Struct wasmer_backend_api::global_id::GlobalId
source · pub struct GlobalId {
kind: NodeKind,
database_id: u64,
}
Expand description
Global id of backend nodes.
IDs are encoded using the “hashid” scheme, which uses a given alphabet and a salt to encode u64 numbers into a string hash.
Fields§
§kind: NodeKind
The node type of the ID.
database_id: u64
The database ID of the node.
Implementations§
source§impl GlobalId
impl GlobalId
sourceconst MIN_LENGTH: usize = 12usize
const MIN_LENGTH: usize = 12usize
Minimum length of the encoded hashes.
sourceconst ALPHABET_PREFIXED: &'static str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
const ALPHABET_PREFIXED: &'static str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
Hash alphabet used for the prefix id variant.
sourceconst ALPHABET_URL: &'static str = "abcdefghijklmnopqrstuvwxyz0123456789"
const ALPHABET_URL: &'static str = "abcdefghijklmnopqrstuvwxyz0123456789"
Hash alphabet used for the non-prefixed id variant.
pub fn new(kind: NodeKind, database_id: u64) -> Self
fn build_harsh(alphabet: &str, salt: &[u8]) -> Harsh
fn build_harsh_prefixed() -> Harsh
fn build_harsh_url() -> Harsh
pub fn kind(&self) -> NodeKind
pub fn database_id(&self) -> u64
sourcepub fn encode_prefixed(&self) -> String
pub fn encode_prefixed(&self) -> String
Encode a prefixed global id.
fn parse_values(values: &[u64]) -> Result<Self, ErrorKind>
sourcepub fn parse_prefixed(hash: &str) -> Result<Self, GlobalIdParseError>
pub fn parse_prefixed(hash: &str) -> Result<Self, GlobalIdParseError>
Parse a prefixed global id.
sourcepub fn encode_url(&self) -> String
pub fn encode_url(&self) -> String
Encode a non-prefixed global id.
Note: URL ids use a different alphabet than prefixed ids.
sourcepub fn parse_url(hash: &str) -> Result<Self, GlobalIdParseError>
pub fn parse_url(hash: &str) -> Result<Self, GlobalIdParseError>
Parse a non-prefixed URL global id variant.
Note: URL ids use a different alphabet than prefixed ids.
Trait Implementations§
source§impl PartialEq for GlobalId
impl PartialEq for GlobalId
impl Copy for GlobalId
impl Eq for GlobalId
impl StructuralPartialEq for GlobalId
Auto Trait Implementations§
impl Freeze for GlobalId
impl RefUnwindSafe for GlobalId
impl Send for GlobalId
impl Sync for GlobalId
impl Unpin for GlobalId
impl UnwindSafe for GlobalId
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.