Enum Serde

Source
pub(super) enum Serde {
    Bool(bool),
    Str(String),
    Num(u32),
    Name {
        name: String,
    },
    Raw {
        raw_name: OsString,
    },
    Special {
        special: String,
    },
    Id {
        id: u32,
    },
}
Available on target_family="unix" and non-iOS and non-Android and non-tvOS and crate feature serde only.
Expand description

Helper type: when encoding or decoding a group or user, we do so as one of these.

It’s an untagged enumeration, so every case must be uniquely identifiable by type or by keywords.

Variants§

§

Bool(bool)

A boolean value.

“false” means “no user”, and is the same as “none”.

“true” is not allowed.

§

Str(String)

A string given in quotes.

If this starts with “:” it will be interpreted as a special entity (e.g. “:current” or “:username”). Otherwise, it will be interpreted as a name.

§

Num(u32)

An integer provided without any identification.

This will be interpreted as a UID or GID.

§

Name

A name, explicitly qualified as such.

Fields

§name: String

The name in question.

Even if this begins with “:”, it is still interpreted as a name.

§

Raw

A username that cannot be represented as a String.

Fields

§raw_name: OsString

The username in question.

§

Special

A special entity.

Fields

§special: String

The name of the special entity. Starts with “:”.

§

Id

A UID or GID, explicitly qualified as such.

Fields

§id: u32

The UID or GID.

Implementations§

Source§

impl Serde

Source

fn disambiguate(self) -> Self

Convert this Serde into a less ambiguous form.

Removes all Num and Str cases from the output, replacing them with Special/Name/Id as appropriate.

Trait Implementations§

Source§

impl Clone for Serde

Source§

fn clone(&self) -> Serde

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Serde

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Serde

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<TrustedGroup> for Serde

Source§

fn from(value: TrustedGroup) -> Self

Converts to this type from the input type.
Source§

impl From<TrustedUser> for Serde

Source§

fn from(value: TrustedUser) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Serde

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Serde> for TrustedGroup

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(ent: Serde) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Serde> for TrustedUser

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(ent: Serde) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for Serde

§

impl RefUnwindSafe for Serde

§

impl Send for Serde

§

impl Sync for Serde

§

impl Unpin for Serde

§

impl UnwindSafe for Serde

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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