Struct PlainName
pub struct PlainName<'a> {
pub resource_func: Option<ResourceFuncKind>,
pub accessor: Option<AccessorKind>,
/* private fields */
}Expand description
A plain name, possibly with resource func annotations like [constructor]
or [method] and with accessor annotations like [get] or [set].
Fields§
§resource_func: Option<ResourceFuncKind>The type of resource function, if any.
accessor: Option<AccessorKind>The type of accessor, if any.
Implementations§
§impl<'a> PlainName<'a>
impl<'a> PlainName<'a>
pub fn new(raw: &'a str) -> PlainName<'a>
pub fn new(raw: &'a str) -> PlainName<'a>
Constructs a new PlainName with a canonicalized form and associated
ResourceFuncKind and AccessorKind. raw should be the full text
of the name, including annotations, and should already be well-formed
(see ComponentNameParser).
pub fn as_str(&self) -> &'a str
pub fn as_str(&self) -> &'a str
Returns the underlying string as a-b (or a-b.c-d if [method] or
[static]).
pub fn resource(&self) -> Option<KebabStr<'a>>
pub fn resource(&self) -> Option<KebabStr<'a>>
If the name is associated with a resource type, returns the resource name.
pub fn name(&self) -> KebabStr<'a>
pub fn name(&self) -> KebabStr<'a>
Returns the main part of the name, i.e. the entire name (for bare names
and [constructor]) or the part after the dot for [method] and
[static].
a-b=>a-b[constructor]a-b=>a-b[method]a-b.c-d=>c-d[static][get]a-b.c-d=>c-d
pub fn getter_for_setter(&self) -> String
pub fn getter_for_setter(&self) -> String
If this name is a setter ([set]), returns the name of the expected
matching getter. Panics if this name is not a setter.
Trait Implementations§
impl Eq for PlainName<'_>
§impl Ord for PlainName<'_>
impl Ord for PlainName<'_>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl<'a> Freeze for PlainName<'a>
impl<'a> RefUnwindSafe for PlainName<'a>
impl<'a> Send for PlainName<'a>
impl<'a> Sync for PlainName<'a>
impl<'a> Unpin for PlainName<'a>
impl<'a> UnsafeUnpin for PlainName<'a>
impl<'a> UnwindSafe for PlainName<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more