pub struct Config {
pub version: u8,
pub connection: ConnectionType,
pub ip_method: IpMethod,
pub led_brightness: u8,
pub station_config: WifiConfig,
pub ap_config: WifiConfig,
pub dmx_ports: FnvIndexMap<u8, DmxPortConfig, MAX_DMX_PORTS>,
pub button_actions: FnvIndexMap<u8, ButtonAction, MAX_BUTTON_ACTIONS>,
}Expand description
Complete device configuration (web: Config).
Field suffixes mirror the web JSON contract — renaming for the lint would break the API.
Fields§
§version: u8Configuration schema version (for future migration).
connection: ConnectionTypeNetwork connection type.
ip_method: IpMethodIP assignment method for station mode.
led_brightness: u8LED brightness (0–255).
station_config: WifiConfigWiFi station credentials.
ap_config: WifiConfigWiFi access-point credentials (empty SSID derives from the MAC).
dmx_ports: FnvIndexMap<u8, DmxPortConfig, MAX_DMX_PORTS>DMX ports by port index.
Button actions by button index.
Implementations§
Source§impl Config
impl Config
Sourcepub fn to_bytes(&self) -> Result<Vec<u8, MAX_CONFIG_BYTES>, Error>
pub fn to_bytes(&self) -> Result<Vec<u8, MAX_CONFIG_BYTES>, Error>
Serialize config to bytes using postcard (binary format).
Returns a Vec with max MAX_CONFIG_BYTES capacity.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, Error>
pub fn from_bytes(data: &[u8]) -> Result<Self, Error>
Deserialize config from bytes.
Sourcepub fn apply(&self)
pub fn apply(&self)
Pushes this configuration into every driver that consumes it.
Called once at boot after loading and again whenever the config
changes (WebSocket config.set, factory reset) — the single place
mapping config fields onto driver state. Network changes apply on
the next reboot.
Sourcepub fn merge_patch(&mut self, patch: ConfigPatch) -> bool
pub fn merge_patch(&mut self, patch: ConfigPatch) -> bool
Merge a partial patch onto this config (present fields win).
This is the server-side counterpart of the web UI’s
DeepPartial<Config> PATCH semantics: nested objects
(ap_config, station_config, dmx_ports[*]) merge field by
field, map entries merge per key, scalar fields replace when
present.
Returns false when the patch is rejected — a map key outside
0..MAX_* or a map that is already full. Keys are validated before
anything is merged, so a rejected patch leaves the config untouched
(HTTP/WS answer 400 and must not persist).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)