Struct sea_orm_rocket::figment::Profile [−]
pub struct Profile(_);Expand description
A configuration profile: effectively a case-insensitive string.
See the top-level docs for details.
Implementations
impl Profile
impl Profile
Constructs a profile with the name name.
Example
use figment::Profile;
let profile = Profile::new("staging");
assert_eq!(profile, "staging");
assert_eq!(profile, "STAGING");A const to construct a profile with the name name.
Example
use figment::Profile;
const STAGING: Profile = Profile::const_new("staging");
assert_eq!(STAGING, "staging");
assert_eq!(STAGING, "STAGING");Constructs a profile from the value of the environment variable with
name name, if one is present. The search for name is
case-insensitive.
Example
use figment::{Profile, Jail};
Jail::expect_with(|jail| {
jail.set_env("MY_PROFILE", "secret");
assert_eq!(Profile::from_env("MY_PROFILE"), Some("secret".into()));
assert_eq!(Profile::from_env("MY_PROFILE"), Some("secret".into()));
assert_eq!(Profile::from_env("MY_profile"), Some("secret".into()));
assert_eq!(Profile::from_env("other_profile"), None);
Ok(())
});pub fn from_env_or<P>(var: &str, default: P) -> Profile where
P: Into<Profile>,
pub fn from_env_or<P>(var: &str, default: P) -> Profile where
P: Into<Profile>,
Constructs a profile from the value of the environment variable with
name name, if one is present, or default if one is not. The search
for name is case-insensitive.
Example
use figment::{Profile, Jail};
Jail::expect_with(|jail| {
jail.set_env("MY_PROFILE", "secret");
assert_eq!(Profile::from_env_or("MY_PROFILE", "default"), "secret");
assert_eq!(Profile::from_env_or("MY_profile", "default"), "secret");
assert_eq!(Profile::from_env_or("other_prof", "default"), "default");
Ok(())
});pub fn as_str(&self) -> &UncasedStr
pub fn as_str(&self) -> &UncasedStr
Converts self into an &UncasedStr.
Example
use figment::Profile;
let profile = Profile::new("static");
let string = profile.as_str();pub fn starts_with(&self, prefix: &str) -> bool
pub fn starts_with(&self, prefix: &str) -> bool
Returns true iff self case-insensitively starts with prefix.
Example
use figment::Profile;
let profile = Profile::new("static");
assert!(profile.starts_with("STAT"));
assert!(profile.starts_with("stat"));
assert!(profile.starts_with("static"));Returns true iff self is neither “default” nor “global”.
Example
use figment::Profile;
let profile = Profile::new("static");
assert!(profile.is_custom());
assert!(!Profile::Default.is_custom());
assert!(!Profile::Global.is_custom());Creates a new map with a single key of *self and a value of dict.
Example
use figment::{Profile, util::map};
let profile = Profile::new("static");
let map = profile.collect(map!["hi".into() => 123.into()]);Methods from Deref<Target = UncasedStr>
Returns self as an &str.
Example
use uncased::UncasedStr;
let uncased_str = UncasedStr::new("Hello!");
assert_eq!(uncased_str.as_str(), "Hello!");
assert_ne!(uncased_str.as_str(), "hELLo!");Returns the length, in bytes, of self.
Example
use uncased::UncasedStr;
let uncased_str = UncasedStr::new("Hello!");
assert_eq!(uncased_str.len(), 6);Returns true if self has a length of zero bytes.
Examples
use uncased::UncasedStr;
let s = UncasedStr::new("");
assert!(s.is_empty());
let s = UncasedStr::new("not empty");
assert!(!s.is_empty());pub fn starts_with(&self, string: &str) -> bool
pub fn starts_with(&self, string: &str) -> bool
Returns true if self starts with any casing of the string string;
otherwise, returns false.
Example
use uncased::UncasedStr;
let uncased_str = UncasedStr::new("MoOO");
assert!(uncased_str.starts_with("moo"));
assert!(uncased_str.starts_with("MOO"));
assert!(uncased_str.starts_with("MOOO"));
assert!(!uncased_str.starts_with("boo"));
let uncased_str = UncasedStr::new("Bèe");
assert!(!uncased_str.starts_with("Be"));
assert!(uncased_str.starts_with("Bè"));
assert!(uncased_str.starts_with("Bè"));
assert!(uncased_str.starts_with("bèe"));
assert!(uncased_str.starts_with("BèE"));Trait Implementations
type Target = UncasedStr
type Target = UncasedStr
The resulting type after dereferencing.
pub fn deref(&self) -> &UncasedStr
pub fn deref(&self) -> &UncasedStr
Dereferences the value.
impl<'de> Deserialize<'de> for Profile
impl<'de> Deserialize<'de> for Profile
pub fn deserialize<D>(
deserializer: D
) -> Result<Profile, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<Profile, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl PartialOrd<Profile> for Profile
impl PartialOrd<Profile> for Profile
pub fn partial_cmp(&self, other: &Profile) -> Option<Ordering>
pub fn partial_cmp(&self, other: &Profile) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
pub fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralEq for Profile
impl StructuralPartialEq for Profile
Auto Trait Implementations
impl RefUnwindSafe for Profile
impl UnwindSafe for Profile
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self into a collection.
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
