Struct peace_core::Profile
source · pub struct Profile(_);Expand description
Identifier or namespace to distinguish execution environments.
Example suitable identifiers are:
"dev_user1""dev_user2""prod_customer1"
Must begin with a letter or underscore, and contain only letters, numbers, and underscores.
Examples
The following are all examples of valid Profiles:
let _snake = profile!("snake_case");
let _camel = profile!("camelCase");
let _pascal = profile!("PascalCase");Implementations§
source§impl Profile
impl Profile
sourcepub fn new(s: &'static str) -> Result<Self, ProfileInvalidFmt<'_>>
pub fn new(s: &'static str) -> Result<Self, ProfileInvalidFmt<'_>>
Returns a new Profile if the given &str is valid.
Most users should use the profile! macro as this provides
compile time checks and returns a const value.
sourcepub fn is_valid_id(proposed_id: &str) -> bool
pub fn is_valid_id(proposed_id: &str) -> bool
Returns whether the provided &str is a valid station identifier.
Methods from Deref<Target = Cow<'static, str>>§
sourcepub fn is_borrowed(&self) -> bool
🔬This is a nightly-only experimental API. (cow_is_borrowed)
pub fn is_borrowed(&self) -> bool
cow_is_borrowed)Returns true if the data is borrowed, i.e. if to_mut would require additional work.
Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow = Cow::Borrowed("moo");
assert!(cow.is_borrowed());
let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
assert!(!bull.is_borrowed());sourcepub fn is_owned(&self) -> bool
🔬This is a nightly-only experimental API. (cow_is_borrowed)
pub fn is_owned(&self) -> bool
cow_is_borrowed)Returns true if the data is owned, i.e. if to_mut would be a no-op.
Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
assert!(cow.is_owned());
let bull = Cow::Borrowed("...moo?");
assert!(!bull.is_owned());Trait Implementations§
source§impl<'de> Deserialize<'de> for Profile
impl<'de> Deserialize<'de> for Profile
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq<Profile> for Profile
impl PartialEq<Profile> for Profile
source§impl TryFrom<&'static str> for Profile
impl TryFrom<&'static str> for Profile
§type Error = ProfileInvalidFmt<'static>
type Error = ProfileInvalidFmt<'static>
The type returned in the event of a conversion error.
source§impl TryFrom<String> for Profile
impl TryFrom<String> for Profile
§type Error = ProfileInvalidFmt<'static>
type Error = ProfileInvalidFmt<'static>
The type returned in the event of a conversion error.