Config

Struct 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>>

Currently loaded plugin settings

§loaded_configs: RwLock<HashMap<String, UniqueDeviceConfig>>

Currently loaded device configs

§loaded_images: RwLock<HashMap<String, ImageCollection>>

Currently loaded image collections

Implementations§

Source§

impl Config

Source

pub async fn get(custom_config_path: Option<PathBuf>) -> Config

Reads config and retrieves config struct

Source

pub fn frame_rate(&self) -> u32

Pool rate, defaults to DEFAULT_FRAME_RATE if not set

Source

pub fn reconnect_rate(&self) -> f32

Reconnect rate, defaults to DEFAULT_RECONNECT_TIME if not set

Source

pub fn autosave(&self) -> bool

Autosave option, defaults to true if not set

Source

pub fn plugin_compatibility_checks(&self) -> bool

Plugin compatibility checks, defaults to true if not set

Source

pub fn device_config_path(&self) -> PathBuf

Device config path, defaults to [data_dir]/DEVICE_CONFIG_FOLDER or DEVICE_CONFIG_FOLDER if not set

Source

pub fn plugin_path(&self) -> PathBuf

Plugin folder path, defaults to [config_dir]/PLUGINS_FOLDER or PLUGINS_FOLDER if not set

Source

pub fn font_path(&self) -> PathBuf

Fonts folder path, defaults to [config_dir]/FONTS_FOLDER or FONTS_FOLDER if not set

Source

pub fn plugin_settings_path(&self) -> PathBuf

Plugin settings file path, defaults to [data_dir]/PLUGINS_SETTINGS_FILE or PLUGINS_SETTINGS_FILE if not set

Source

pub fn data_dir(&self) -> &PathBuf

Data path, defaults to dirs::data_dir() if not set

Source

pub fn config_dir(&self) -> &PathBuf

Config path, defaults to dirs::config_dir() if not set

Source

pub async fn load_plugin_settings(&self)

Loads plugin settings from file

Source

pub async fn get_plugin_settings<T: PluginConfig + DeserializeOwned>( &self, ) -> Option<T>

Retrieves plugin settings if it exists

Source

pub async fn set_plugin_settings<T: PluginConfig + Serialize>(&self, value: T)

Sets plugin settings

Source

pub async fn write_plugin_settings(&self)

Writes plugin settings to file

Source

pub async fn reload_device_config( &self, serial: &str, ) -> Result<(), ConfigError>

Reloads device config for specified serial

Source

pub async fn reload_device_configs(&self) -> Result<(), ConfigError>

Reloads all device configs

Source

pub async fn save_device_config(&self, serial: &str) -> Result<(), ConfigError>

Saves device config for specified serial

Source

pub async fn save_device_configs(&self) -> Result<(), ConfigError>

Saves device configs for all serials

Source

pub async fn get_device_config( &self, serial: &str, ) -> Option<UniqueDeviceConfig>

Retrieves device config for specified serial

Source

pub async fn set_device_config(&self, serial: &str, config: DeviceConfig)

Sets device config for specified serial

Source

pub async fn get_all_device_configs(&self) -> Vec<UniqueDeviceConfig>

Gets an array of all device configs

Source

pub async fn disable_device_config(&self, serial: &str) -> bool

Disables a device config, so it will not be loaded by default

Source

pub async fn restore_device_config(&self, serial: &str) -> bool

Restores device config if it exists

Source

pub async fn add_image(&self, serial: &str, image: String) -> Option<String>

Adds base64 image to device config image collection

Source

pub async fn add_image_encode( &self, serial: &str, image: DynamicImage, ) -> Option<String>

Encodes image to base64 and adds it to device config image collection

Source

pub async fn get_images( &self, serial: &str, ) -> Option<HashMap<String, SDSerializedImage>>

Gets images from device config

Source

pub async fn remove_image(&self, serial: &str, identifier: &str) -> bool

Removes image from device config

Source

pub async fn sync_images(&self, serial: &str)

Syncs images with core

Source

pub async fn get_image_collection(&self, serial: &str) -> ImageCollection

Retrieves image collection for device if device exists

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Config

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

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 Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

Blanket Implementations§

Source§

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>,

Source§

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
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
Source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

Source§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
Source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, Dst> ConvAsUtil<Dst> for T

Source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
Source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
Source§

impl<T> ConvUtil for T

Source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
Source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
Source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
Source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
Source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

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().
Source§

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().
Source§

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().
Source§

impl<Src> TryFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

Source§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

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
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<Src> ValueFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
Source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

Source§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,