[][src]Struct sync_guid::Guid

pub struct Guid(Repr);

This is a type intended to be used to represent the guids used by sync. It has several benefits over using a String:

  1. It's more explicit about what is being stored, and could prevent bugs where a Guid is passed to a function expecting text.

  2. Guids are guaranteed to be immutable.

  3. 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]

fn default() -> Self[src]

Create a default guid by calling Guid::empty()

impl Deref for Guid[src]

type Target = str

The resulting type after dereferencing.

impl<'de> Deserialize<'de> for Guid[src]

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]

impl Hash for Guid[src]

impl Ord for Guid[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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CallHasher for T where
    T: Hash

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,