[−][src]Struct oceanpkg::drop::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]
N: TryInto<&'a Self, Error = ValidateError>,
Attempts to create a new instance by parsing name
.
pub unsafe fn new_unchecked<N: ?Sized>(name: &N) -> &Self where
N: AsRef<[u8]>,
[src]
N: AsRef<[u8]>,
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]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for Name
[src]
impl Eq for Name
[src]
impl<'_> From<&'_ Name> for Box<Name>
[src]
impl Hash for Name
[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 Name
[src]
fn cmp(&self, other: &Name) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[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]
fn partial_cmp(&self, other: &Name) -> Option<Ordering>
[src]
fn lt(&self, other: &Name) -> bool
[src]
fn le(&self, other: &Name) -> bool
[src]
fn gt(&self, other: &Name) -> bool
[src]
fn ge(&self, other: &Name) -> bool
[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.
fn try_from(bytes: &'a [u8]) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a CStr> for &'a Name
[src]
type Error = ValidateError
The type returned in the event of a conversion error.
fn try_from(s: &'a CStr) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a OsStr> for &'a Name
[src]
type Error = ValidateError
The type returned in the event of a conversion error.