[−][src]Struct sync_guid::Guid
This is a type intended to be used to represent the guids used by sync. It
has several benefits over using a String
:
-
It's more explicit about what is being stored, and could prevent bugs where a Guid is passed to a function expecting text.
-
Guids are guaranteed to be immutable.
-
It's optimized for the guids commonly used by sync. In particular, short guids (including the guids which would meet
PlacesUtils.isValidGuid
) do not incur any heap allocation, and are stored inline.
Implementations
impl Guid
[src]
pub fn new(s: &str) -> Self
[src]
Create a guid from a str
.
pub const fn empty() -> Self
[src]
Create an empty guid. Usable as a constant.
pub fn random() -> Self
[src]
Create a random guid (of 12 base64url characters). Requires the random
feature.
pub fn from_string(s: String) -> Self
[src]
Convert b
into a Guid
.
pub fn from_slice(b: &[u8]) -> Self
[src]
Convert b
into a Guid
.
pub fn from_vec(v: Vec<u8>) -> Self
[src]
Convert v
to a Guid
, consuming it.
pub fn as_bytes(&self) -> &[u8]
[src]
Get the data backing this Guid
as a &[u8]
.
pub fn as_str(&self) -> &str
[src]
Get the data backing this Guid
as a &str
.
pub fn into_string(self) -> String
[src]
Convert this Guid
into a String
, consuming it in the process.
pub fn is_valid_for_sync_server(&self) -> bool
[src]
Returns true for Guids that are deemed valid by the sync server. See https://github.com/mozilla-services/server-syncstorage/blob/d92ef07877aebd05b92f87f6ade341d6a55bffc8/syncstorage/bso.py#L24
pub fn is_valid_for_places(&self) -> bool
[src]
Returns true for Guids that are valid places guids, and false for all others.
pub fn is_valid_places_byte(b: u8) -> bool
[src]
Returns true if the byte b
is a valid base64url byte.
fn new_slow(v: Vec<u8>) -> Self
[src]
Trait Implementations
impl AsRef<[u8]> for Guid
[src]
impl AsRef<str> for Guid
[src]
impl Clone for Guid
[src]
impl Debug for Guid
[src]
impl Default for Guid
[src]
impl Deref for Guid
[src]
impl<'de> Deserialize<'de> for Guid
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for Guid
[src]
impl Eq for Guid
[src]
impl<'a, '_> From<&'a &'_ str> for Guid
[src]
impl<'a> From<&'a [u8]> for Guid
[src]
impl<'a> From<&'a str> for Guid
[src]
impl From<Guid> for String
[src]
impl From<Guid> for Vec<u8>
[src]
impl From<String> for Guid
[src]
impl From<Vec<u8>> for Guid
[src]
impl FromSql for Guid
[src]
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>
[src]
impl Hash for Guid
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Guid
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'a> PartialEq<&'a [u8]> for Guid
[src]
impl<'a> PartialEq<&'a str> for Guid
[src]
impl<'a> PartialEq<[u8]> for Guid
[src]
impl PartialEq<Guid> for Guid
[src]
impl<'a> PartialEq<Guid> for str
[src]
impl<'a> PartialEq<Guid> for &'a str
[src]
impl<'a> PartialEq<Guid> for String
[src]
impl<'a> PartialEq<Guid> for [u8]
[src]
impl<'a> PartialEq<Guid> for &'a [u8]
[src]
impl<'a> PartialEq<Guid> for Vec<u8>
[src]
impl<'a> PartialEq<String> for Guid
[src]
impl<'a> PartialEq<Vec<u8>> for Guid
[src]
impl<'a> PartialEq<str> for Guid
[src]
impl PartialOrd<Guid> for Guid
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Guid
[src]
impl ToSql for Guid
[src]
Auto Trait Implementations
impl RefUnwindSafe for Guid
impl Send for Guid
impl Sync for Guid
impl Unpin for Guid
impl UnwindSafe for Guid
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,