Struct nostr_relay::setting::Setting
source · 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 Settingwhere
Setting: Default,
impl<'de> Deserialize<'de> for Settingwhere Setting: Default,
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 !RefUnwindSafe for Setting
impl Send for Setting
impl Sync for Setting
impl Unpin for Setting
impl !UnwindSafe for Setting
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
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>
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§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.