pub struct MatrixRpcConfig {
pub global: GlobalConfig,
pub services: HashMap<String, ServiceDefinition>,
}Expand description
Root configuration structure for matrixrpc.toml
Fields§
§global: GlobalConfigGlobal settings
services: HashMap<String, ServiceDefinition>Service definitions
Implementations§
Source§impl MatrixRpcConfig
impl MatrixRpcConfig
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError>
Load configuration from a file
Sourcepub fn load_default() -> Result<Self, ConfigError>
pub fn load_default() -> Result<Self, ConfigError>
Load configuration from the default location
Sourcepub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), ConfigError>
pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), ConfigError>
Save configuration to a file
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate the configuration
Sourcepub fn get_service(&self, name: &str) -> Option<&ServiceDefinition>
pub fn get_service(&self, name: &str) -> Option<&ServiceDefinition>
Get a service definition by name
Sourcepub fn add_service(
&mut self,
name: impl Into<String>,
service: ServiceDefinition,
)
pub fn add_service( &mut self, name: impl Into<String>, service: ServiceDefinition, )
Add a service definition
Sourcepub fn create_service(
&self,
name: &str,
) -> Result<ExtensionService, ConfigError>
pub fn create_service( &self, name: &str, ) -> Result<ExtensionService, ConfigError>
Convert service definition to ExtensionService
Sourcepub fn service_names(&self) -> Vec<&String>
pub fn service_names(&self) -> Vec<&String>
List all service names
Trait Implementations§
Source§impl Clone for MatrixRpcConfig
impl Clone for MatrixRpcConfig
Source§fn clone(&self) -> MatrixRpcConfig
fn clone(&self) -> MatrixRpcConfig
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 MatrixRpcConfig
impl Debug for MatrixRpcConfig
Source§impl Default for MatrixRpcConfig
impl Default for MatrixRpcConfig
Source§impl<'de> Deserialize<'de> for MatrixRpcConfig
impl<'de> Deserialize<'de> for MatrixRpcConfig
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
Auto Trait Implementations§
impl Freeze for MatrixRpcConfig
impl RefUnwindSafe for MatrixRpcConfig
impl Send for MatrixRpcConfig
impl Sync for MatrixRpcConfig
impl Unpin for MatrixRpcConfig
impl UnsafeUnpin for MatrixRpcConfig
impl UnwindSafe for MatrixRpcConfig
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