Struct streamduck_core::config::Config
source · [−]pub struct Config {
pub plugin_settings: RwLock<HashMap<String, Value>>,
pub loaded_configs: RwLock<HashMap<String, UniqueDeviceConfig>>,
pub loaded_images: RwLock<HashMap<String, ImageCollection>>,
/* private fields */
}Expand description
Struct to keep daemon settings
Fields
plugin_settings: RwLock<HashMap<String, Value>>loaded_configs: RwLock<HashMap<String, UniqueDeviceConfig>>Currently loaded device configs
loaded_images: RwLock<HashMap<String, ImageCollection>>Currently loaded image collections
Implementations
sourceimpl Config
impl Config
sourcepub fn pool_rate(&self) -> u32
pub fn pool_rate(&self) -> u32
Pool rate, defaults to DEFAULT_POOL_RATE if not set
sourcepub fn reconnect_rate(&self) -> f32
pub fn reconnect_rate(&self) -> f32
Reconnect rate, defaults to DEFAULT_RECONNECT_TIME if not set
sourcepub fn device_config_path(&self) -> PathBuf
pub fn device_config_path(&self) -> PathBuf
Device config path, defaults to DEFAULT_CONFIG_PATH if not set
sourcepub fn plugin_path(&self) -> PathBuf
pub fn plugin_path(&self) -> PathBuf
Plugin folder path, defaults to DEFAULT_PLUGIN_PATH if not set
sourcepub fn plugin_settings_path(&self) -> PathBuf
pub fn plugin_settings_path(&self) -> PathBuf
Global config path, defaults to DEFAULT_PLUGIN_SETTINGS_PATH if not set
sourcepub fn load_plugin_settings(&self)
pub fn load_plugin_settings(&self)
Loads plugin settings from file
sourcepub fn get_plugin_settings<T: PluginConfig + DeserializeOwned>(
&self
) -> Option<T>
pub fn get_plugin_settings<T: PluginConfig + DeserializeOwned>(
&self
) -> Option<T>
Retrieves plugin settings if it exists
sourcepub fn set_plugin_settings<T: PluginConfig + Serialize>(&self, value: T)
pub fn set_plugin_settings<T: PluginConfig + Serialize>(&self, value: T)
Sets plugin settings
sourcepub fn write_plugin_settings(&self)
pub fn write_plugin_settings(&self)
Writes plugin settings to file
sourcepub fn reload_device_config(&self, serial: &str) -> Result<(), ConfigError>
pub fn reload_device_config(&self, serial: &str) -> Result<(), ConfigError>
Reloads device config for specified serial
sourcepub fn reload_device_configs(&self) -> Result<(), ConfigError>
pub fn reload_device_configs(&self) -> Result<(), ConfigError>
Reloads all device configs
sourcepub fn save_device_config(&self, serial: &str) -> Result<(), ConfigError>
pub fn save_device_config(&self, serial: &str) -> Result<(), ConfigError>
Saves device config for specified serial
sourcepub fn save_device_configs(&self) -> Result<(), ConfigError>
pub fn save_device_configs(&self) -> Result<(), ConfigError>
Saves device configs for all serials
sourcepub fn get_device_config(&self, serial: &str) -> Option<UniqueDeviceConfig>
pub fn get_device_config(&self, serial: &str) -> Option<UniqueDeviceConfig>
Retrieves device config for specified serial
sourcepub fn set_device_config(&self, serial: &str, config: DeviceConfig)
pub fn set_device_config(&self, serial: &str, config: DeviceConfig)
Sets device config for specified serial
sourcepub fn get_all_device_configs(&self) -> Vec<UniqueDeviceConfig>
pub fn get_all_device_configs(&self) -> Vec<UniqueDeviceConfig>
Gets an array of all device configs
sourcepub fn disable_device_config(&self, serial: &str) -> bool
pub fn disable_device_config(&self, serial: &str) -> bool
Disables a device config, so it will not be loaded by default
sourcepub fn restore_device_config(&self, serial: &str) -> bool
pub fn restore_device_config(&self, serial: &str) -> bool
Restores device config if it exists
sourcepub fn add_image(&self, serial: &str, image: String) -> Option<String>
pub fn add_image(&self, serial: &str, image: String) -> Option<String>
Adds base64 image to device config image collection
sourcepub fn add_image_encode(
&self,
serial: &str,
image: DynamicImage
) -> Option<String>
pub fn add_image_encode(
&self,
serial: &str,
image: DynamicImage
) -> Option<String>
Encodes image to base64 and adds it to device config image collection
sourcepub fn get_images(
&self,
serial: &str
) -> Option<HashMap<String, SDSerializedImage>>
pub fn get_images(
&self,
serial: &str
) -> Option<HashMap<String, SDSerializedImage>>
Gets images from device config
sourcepub fn remove_image(&self, serial: &str, identifier: &str) -> bool
pub fn remove_image(&self, serial: &str, identifier: &str) -> bool
Removes image from device config
sourcepub fn sync_images(&self, serial: &str)
pub fn sync_images(&self, serial: &str)
Syncs images with core
sourcepub fn get_image_collection(&self, serial: &str) -> ImageCollection
pub fn get_image_collection(&self, serial: &str) -> ImageCollection
Retrieves image collection for device if device exists
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
sourcefn 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 RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford method by default Read more
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ConvUtil for T
impl<T> ConvUtil for T
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
sourceimpl<T, U> IntoColor<U> for T where
U: FromColor<T>,
impl<T, U> IntoColor<U> for T where
U: FromColor<T>,
sourcefn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
sourceimpl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
sourcefn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
sourceimpl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
sourcefn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds error is returned which contains
the unclamped color. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
type Err = NoError
type Err = NoError
The error type produced by a failed conversion.
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
type Err = <Dst as ValueFrom<Src>>::Err
type Err = <Dst as ValueFrom<Src>>::Err
The error type produced by a failed conversion.
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
Convert the subject into an exactly equivalent representation.