pub struct ResourceKey(/* private fields */);Expand description
Stable key for a localized resource.
Keys use the canonical shape:
{domain}for base files{domain}/{namespace}for namespaced files
Implementations§
Source§impl ResourceKey
impl ResourceKey
Sourcepub fn try_new(key: impl Into<String>) -> Result<ResourceKey, ResourceKeyError>
pub fn try_new(key: impl Into<String>) -> Result<ResourceKey, ResourceKeyError>
Validates and creates a resource key.
Sourcepub fn from_static_path(key: &'static str) -> ResourceKey
pub fn from_static_path(key: &'static str) -> ResourceKey
Validates and creates a resource key from static metadata.
Sourcepub fn from_static_domain(domain: StaticFluentDomain) -> ResourceKey
pub fn from_static_domain(domain: StaticFluentDomain) -> ResourceKey
Creates a base resource key from an already-validated static Fluent domain.
Sourcepub fn from_static_domain_and_namespace(
domain: StaticFluentDomain,
namespace: &ResolvedNamespace,
) -> ResourceKey
pub fn from_static_domain_and_namespace( domain: StaticFluentDomain, namespace: &ResolvedNamespace, ) -> ResourceKey
Creates a namespaced resource key from already-validated domain and namespace values.
Sourcepub fn domain_name(&self) -> FluentDomain
pub fn domain_name(&self) -> FluentDomain
Returns the domain segment as a validated Fluent domain.
Trait Implementations§
Source§impl AsRef<str> for ResourceKey
impl AsRef<str> for ResourceKey
Source§impl Clone for ResourceKey
impl Clone for ResourceKey
Source§fn clone(&self) -> ResourceKey
fn clone(&self) -> ResourceKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResourceKey
impl Debug for ResourceKey
Source§impl<'de> Deserialize<'de> for ResourceKey
impl<'de> Deserialize<'de> for ResourceKey
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ResourceKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ResourceKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ResourceKey
impl Display for ResourceKey
impl Eq for ResourceKey
Source§impl Hash for ResourceKey
impl Hash for ResourceKey
Source§impl Ord for ResourceKey
impl Ord for ResourceKey
Source§fn cmp(&self, other: &ResourceKey) -> Ordering
fn cmp(&self, other: &ResourceKey) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ResourceKey
impl PartialEq for ResourceKey
Source§impl PartialOrd for ResourceKey
impl PartialOrd for ResourceKey
Source§impl Serialize for ResourceKey
impl Serialize for ResourceKey
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ResourceKey
Auto Trait Implementations§
impl Freeze for ResourceKey
impl RefUnwindSafe for ResourceKey
impl Send for ResourceKey
impl Sync for ResourceKey
impl Unpin for ResourceKey
impl UnsafeUnpin for ResourceKey
impl UnwindSafe for ResourceKey
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
Mutably borrows from an owned value. Read more