[][src]Struct oceanpkg::drop::Name

pub struct Name(_);

A valid drop name.

Valid names are non-empty, lowercase ASCII alphanumeric, and can have dashes (-) anywhere except for the beginning or end.

Methods

impl Name[src]

pub const CORE: &'static Self[src]

The string "core".

pub const OCEAN: &'static Self[src]

The string "ocean".

pub const SELF: &'static Self[src]

The string "self".

pub const RESERVED_SCOPES: &'static [&'static Self][src]

Namespaces reserved to only be used only by Ocean.

pub fn new<'a, N>(name: N) -> Result<&'a Self, ValidateError> where
    N: TryInto<&'a Self, Error = ValidateError>, 
[src]

Attempts to create a new instance by parsing name.

pub unsafe fn new_unchecked<N: ?Sized>(name: &N) -> &Self where
    N: AsRef<[u8]>, 
[src]

Creates a new instance without parsing name.

pub fn is_valid<N: AsRef<[u8]>>(name: N) -> bool[src]

Returns whether name is valid.

All characters in name must match the regex [0-9a-z-], with the exception of the first and last character where - is not allowed.

pub fn is_valid_ascii(byte: u8) -> bool[src]

Returns whether byte is valid within a name.

Regex: [0-9a-z-].

Note that this returns true for - despite it being invalid at the start and end of a full name.

pub fn is_valid_char(ch: char) -> bool[src]

Returns whether the unicode scalar is valid within a name.

See is_valid_ascii for more info.

pub const fn as_str(&self) -> &str[src]

Converts self to the underlying UTF-8 string slice.

pub fn into_boxed(&self) -> Box<Self>[src]

Moves copied contents of self to the heap.

pub fn is_reserved_scope(&self) -> bool[src]

Returns whether Ocean reserves the right to use this name as a scope.

Trait Implementations

impl AsRef<[u8]> for Name[src]

impl AsRef<str> for Name[src]

impl Debug for Name[src]

impl<'de: 'a, 'a> Deserialize<'de> for &'a Name[src]

impl Display for Name[src]

impl Eq for Name[src]

impl<'_> From<&'_ Name> for Box<Name>[src]

impl Hash for Name[src]

impl Ord for Name[src]

impl PartialEq<[u8]> for Name[src]

impl PartialEq<Name> for Name[src]

impl PartialEq<Name> for str[src]

impl PartialEq<Name> for [u8][src]

impl PartialEq<str> for Name[src]

impl PartialOrd<Name> for Name[src]

impl Serialize for Name[src]

impl StructuralEq for Name[src]

impl StructuralPartialEq for Name[src]

impl<'a> TryFrom<&'a [u8]> for &'a Name[src]

type Error = ValidateError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a CStr> for &'a Name[src]

type Error = ValidateError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a OsStr> for &'a Name[src]

type Error = ValidateError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a str> for &'a Name[src]

type Error = ValidateError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Name

impl Send for Name

impl Sync for Name

impl Unpin for Name

impl UnwindSafe for Name

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> ToString for T where
    T: Display + ?Sized
[src]