pub struct Setting {
pub information: Information,
pub data: Data,
pub thread: Thread,
pub network: Network,
pub limitation: Limitation,
pub extra: HashMap<String, Value>,
/* private fields */
}
Fields§
§information: Information
§data: Data
§thread: Thread
§network: Network
§limitation: Limitation
§extra: HashMap<String, Value>
flatten extensions setting to json::Value
Implementations§
Source§impl Setting
impl Setting
Sourcepub fn add_information(&mut self, key: String, value: Value)
pub fn add_information(&mut self, key: String, value: Value)
add nip-11 extension information
Sourcepub fn add_limitation(&mut self, key: String, value: Value)
pub fn add_limitation(&mut self, key: String, value: Value)
add nip-11 extension limitation
Sourcepub fn parse_extension<T: DeserializeOwned + Default>(&self, key: &str) -> T
pub fn parse_extension<T: DeserializeOwned + Default>(&self, key: &str) -> T
Parse extension setting.
Sourcepub fn set_extension<T: Send + Sync + 'static>(&mut self, val: T)
pub fn set_extension<T: Send + Sync + 'static>(&mut self, val: T)
save extension setting
Sourcepub fn get_extension<T: 'static>(&self) -> Option<&T>
pub fn get_extension<T: 'static>(&self) -> Option<&T>
get extension setting
Sourcepub fn render_information(&self) -> Result<String>
pub fn render_information(&self) -> Result<String>
nip-11 information json
Sourcepub fn read<P: AsRef<Path>>(file: P, env_prefix: Option<String>) -> Result<Self>
pub fn read<P: AsRef<Path>>(file: P, env_prefix: Option<String>) -> Result<Self>
read config from file and env
Sourcepub fn from_str(s: &str, format: FileFormat) -> Result<Self>
pub fn from_str(s: &str, format: FileFormat) -> Result<Self>
config from str
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Setting
impl<'de> Deserialize<'de> for Setting
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 From<Setting> for SettingWrapper
impl From<Setting> for SettingWrapper
Auto Trait Implementations§
impl Freeze for Setting
impl !RefUnwindSafe for Setting
impl Send for Setting
impl Sync for Setting
impl Unpin for Setting
impl !UnwindSafe for Setting
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.