Skip to main content

RcSyncMixParam

Enum RcSyncMixParam 

Source
#[non_exhaustive]
pub enum RcSyncMixParam { MixDisabled, MixLevelWithAnchor, MixLink, MixLinkRequest, MixMute, MixUnlinkRequest, MixRcSyncLevelRequest, Other(String), }
Expand description

A per-rcSync-mix parameter: the flat properties on each RCSYNCMIX node. Six wire names are shared with the regular MIX cell family (mixDisabled, mixLevelWithAnchor, mixLink, mixLinkRequest, mixMute, mixUnlinkRequest); mixRcSyncLevelRequest is rcSync-specific. The two node types are distinguished by path shape at decode time.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MixDisabled

§

MixLevelWithAnchor

§

MixLinkRequest

§

MixMute

§

MixUnlinkRequest

§

MixRcSyncLevelRequest

§

Other(String)

A property without a typed RcSyncMixParam identifier yet. Holds the raw wire name; the value still rides in the carrying event/command.

Implementations§

Source§

impl RcSyncMixParam

Source

pub fn from_known_name(name: &str) -> Option<RcSyncMixParam>

Map a wire property name to its typed RcSyncMixParam variant if known, without allocating.

Source

pub fn is_known_name(name: &str) -> bool

Check if a wire property name matches a known RcSyncMixParam variant without allocating.

Source

pub fn from_name(name: &str) -> RcSyncMixParam

Map a wire property name to its typed RcSyncMixParam variant. Unknown names map to RcSyncMixParam::Other, so this is total (never fails).

Examples found in repository?
examples/cli.rs (line 1055)
740fn parse_set(args: &[&str]) -> Result<Command, String> {
741    if args.is_empty() {
742        return Err("usage: set <family> [key] <wire-name> <kind> <value...>".into());
743    }
744    let family = args[0].to_ascii_lowercase();
745    let rest = &args[1..];
746    match family.as_str() {
747        "master" => {
748            need_args(rest, 3, "set master <wire-name> <kind> <value>")?;
749            let value = parse_value(&rest[1..])?;
750            Ok(Command::SetMasterParam {
751                param: MasterParam::from_name(rest[0]),
752                value,
753            })
754        }
755        "output" => {
756            need_args(rest, 3, "set output <wire-name> <kind> <value>")?;
757            let value = parse_value(&rest[1..])?;
758            Ok(Command::SetOutputParam {
759                param: OutputParam::from_name(rest[0]),
760                value,
761            })
762        }
763        "ducker" => {
764            need_args(rest, 3, "set ducker <wire-name> <kind> <value>")?;
765            let value = parse_value(&rest[1..])?;
766            Ok(Command::SetDuckerParam {
767                param: DuckerParam::from_name(rest[0]),
768                value,
769            })
770        }
771        "recorder" => {
772            need_args(rest, 3, "set recorder <wire-name> <kind> <value>")?;
773            let value = parse_value(&rest[1..])?;
774            Ok(Command::SetRecorderParam {
775                param: RecorderParam::from_name(rest[0]),
776                value,
777            })
778        }
779        "player" => {
780            need_args(rest, 3, "set player <wire-name> <kind> <value>")?;
781            let value = parse_value(&rest[1..])?;
782            Ok(Command::SetPlayerParam {
783                param: PlayerParam::from_name(rest[0]),
784                value,
785            })
786        }
787        "gui" => {
788            need_args(rest, 3, "set gui <wire-name> <kind> <value>")?;
789            let value = parse_value(&rest[1..])?;
790            Ok(Command::SetGuiParam {
791                param: GuiParam::from_name(rest[0]),
792                value,
793            })
794        }
795        "system" => {
796            need_args(rest, 3, "set system <wire-name> <kind> <value>")?;
797            let value = parse_value(&rest[1..])?;
798            Ok(Command::SetSystemParam {
799                param: SystemParam::from_name(rest[0]),
800                value,
801            })
802        }
803        "channel" => {
804            need_args(rest, 4, "set channel <fader> <wire-name> <kind> <value>")?;
805            let fader = parse_fader(rest[0])?;
806            let value = parse_value(&rest[2..])?;
807            Ok(Command::SetChannelParam {
808                fader,
809                param: ChannelParam::from_name(rest[1]),
810                value,
811            })
812        }
813        "inputsource" | "input-source" | "input_source" => {
814            need_args(
815                rest,
816                4,
817                "set inputsource <source> <wire-name> <kind> <value>",
818            )?;
819            let source = parse_source(rest[0])?;
820            let value = parse_value(&rest[2..])?;
821            Ok(Command::SetInputSourceParam {
822                source,
823                param: InputSourceParam::from_name(rest[1]),
824                value,
825            })
826        }
827        "headphone" => {
828            need_args(rest, 4, "set headphone <0..N> <wire-name> <kind> <value>")?;
829            let headphone: u8 = rest[0]
830                .parse()
831                .map_err(|_| format!("headphone index not numeric: {}", rest[0]))?;
832            let value = parse_value(&rest[2..])?;
833            Ok(Command::SetHeadphoneParam {
834                headphone,
835                param: HeadphoneParam::from_name(rest[1]),
836                value,
837            })
838        }
839        "effects" => {
840            need_args(rest, 4, "set effects <0..N> <wire-name> <kind> <value>")?;
841            let effects: u8 = rest[0]
842                .parse()
843                .map_err(|_| format!("effects index not numeric: {}", rest[0]))?;
844            let value = parse_value(&rest[2..])?;
845            Ok(Command::SetEffectsParam {
846                effects,
847                param: EffectsParam::from_name(rest[1]),
848                value,
849            })
850        }
851        "pad" => {
852            need_args(rest, 4, "set pad <0..N> <wire-name> <kind> <value>")?;
853            let pad: u8 = rest[0]
854                .parse()
855                .map_err(|_| format!("pad index not numeric: {}", rest[0]))?;
856            let value = parse_value(&rest[2..])?;
857            Ok(Command::SetPadParam {
858                pad,
859                param: PadParam::from_name(rest[1]),
860                value,
861            })
862        }
863        "network" => {
864            need_args(rest, 3, "set network <wire-name> <kind> <value>")?;
865            let value = parse_value(&rest[1..])?;
866            Ok(Command::SetNetworkParam {
867                param: NetworkParam::from_name(rest[0]),
868                value,
869            })
870        }
871        "audio" => {
872            need_args(rest, 3, "set audio <wire-name> <kind> <value>")?;
873            let value = parse_value(&rest[1..])?;
874            Ok(Command::SetAudioParam {
875                param: AudioParam::from_name(rest[0]),
876                value,
877            })
878        }
879        "build" => {
880            need_args(rest, 3, "set build <wire-name> <kind> <value>")?;
881            let value = parse_value(&rest[1..])?;
882            Ok(Command::SetBuildParam {
883                param: BuildParam::from_name(rest[0]),
884                value,
885            })
886        }
887        "app" => {
888            need_args(rest, 3, "set app <wire-name> <kind> <value>")?;
889            let value = parse_value(&rest[1..])?;
890            Ok(Command::SetAppParam {
891                param: AppParam::from_name(rest[0]),
892                value,
893            })
894        }
895        "theme" => {
896            need_args(rest, 3, "set theme <wire-name> <kind> <value>")?;
897            let value = parse_value(&rest[1..])?;
898            Ok(Command::SetThemeParam {
899                param: ThemeParam::from_name(rest[0]),
900                value,
901            })
902        }
903        "currentshow" | "current-show" => {
904            need_args(rest, 3, "set currentshow <wire-name> <kind> <value>")?;
905            let value = parse_value(&rest[1..])?;
906            Ok(Command::SetCurrentShowParam {
907                param: CurrentShowParam::from_name(rest[0]),
908                value,
909            })
910        }
911        "showcontrol" | "show-control" => {
912            need_args(rest, 3, "set showcontrol <wire-name> <kind> <value>")?;
913            let value = parse_value(&rest[1..])?;
914            Ok(Command::SetShowControlParam {
915                param: ShowControlParam::from_name(rest[0]),
916                value,
917            })
918        }
919        "recordings" => {
920            need_args(rest, 3, "set recordings <wire-name> <kind> <value>")?;
921            let value = parse_value(&rest[1..])?;
922            Ok(Command::SetRecordingsParam {
923                param: RecordingsParam::from_name(rest[0]),
924                value,
925            })
926        }
927        "radio" => {
928            need_args(rest, 3, "set radio <wire-name> <kind> <value>")?;
929            let value = parse_value(&rest[1..])?;
930            Ok(Command::SetRadioParam {
931                param: RadioParam::from_name(rest[0]),
932                value,
933            })
934        }
935        "show" => {
936            need_args(rest, 4, "set show <0..N> <wire-name> <kind> <value>")?;
937            let show: u8 = rest[0]
938                .parse()
939                .map_err(|_| format!("show index not numeric: {}", rest[0]))?;
940            let value = parse_value(&rest[2..])?;
941            Ok(Command::SetShowParam {
942                show,
943                param: ShowParam::from_name(rest[1]),
944                value,
945            })
946        }
947        "recording" => {
948            need_args(rest, 4, "set recording <0..N> <wire-name> <kind> <value>")?;
949            let recording: u8 = rest[0]
950                .parse()
951                .map_err(|_| format!("recording index not numeric: {}", rest[0]))?;
952            let value = parse_value(&rest[2..])?;
953            Ok(Command::SetRecordingParam {
954                recording,
955                param: RecordingParam::from_name(rest[1]),
956                value,
957            })
958        }
959        "storagevolume" | "storage-volume" => {
960            need_args(
961                rest,
962                4,
963                "set storagevolume <0..N> <wire-name> <kind> <value>",
964            )?;
965            let volume: u8 = rest[0]
966                .parse()
967                .map_err(|_| format!("storage volume index not numeric: {}", rest[0]))?;
968            let value = parse_value(&rest[2..])?;
969            Ok(Command::SetStorageVolumeParam {
970                volume,
971                param: StorageVolumeParam::from_name(rest[1]),
972                value,
973            })
974        }
975        "radiotx" | "radio-tx" => {
976            need_args(rest, 4, "set radiotx <0..N> <wire-name> <kind> <value>")?;
977            let tx: u8 = rest[0]
978                .parse()
979                .map_err(|_| format!("radio tx index not numeric: {}", rest[0]))?;
980            let value = parse_value(&rest[2..])?;
981            Ok(Command::SetRadioTxParam {
982                tx,
983                param: RadioTxParam::from_name(rest[1]),
984                value,
985            })
986        }
987        "radiorx" | "radio-rx" => {
988            need_args(rest, 4, "set radiorx <0..N> <wire-name> <kind> <value>")?;
989            let rx: u8 = rest[0]
990                .parse()
991                .map_err(|_| format!("radio rx index not numeric: {}", rest[0]))?;
992            let value = parse_value(&rest[2..])?;
993            Ok(Command::SetRadioRxParam {
994                rx,
995                param: RadioRxParam::from_name(rest[1]),
996                value,
997            })
998        }
999        "wifiscanresult" | "wifi-scan-result" => {
1000            need_args(
1001                rest,
1002                4,
1003                "set wifiscanresult <0..N> <wire-name> <kind> <value>",
1004            )?;
1005            let slot: u8 = rest[0]
1006                .parse()
1007                .map_err(|_| format!("wifi scan result slot index not numeric: {}", rest[0]))?;
1008            let value = parse_value(&rest[2..])?;
1009            Ok(Command::SetWifiScanResultParam {
1010                slot,
1011                param: WifiScanResultParam::from_name(rest[1]),
1012                value,
1013            })
1014        }
1015        "streamerxmixpreset" | "streamerx-mix-preset" => {
1016            need_args(
1017                rest,
1018                4,
1019                "set streamerxmixpreset <0..N> <wire-name> <kind> <value>",
1020            )?;
1021            let preset: u8 = rest[0]
1022                .parse()
1023                .map_err(|_| format!("streamerx mix preset index not numeric: {}", rest[0]))?;
1024            let value = parse_value(&rest[2..])?;
1025            Ok(Command::SetStreamerXMixPresetParam {
1026                preset,
1027                param: StreamerXMixPresetParam::from_name(rest[1]),
1028                value,
1029            })
1030        }
1031        "streamerxstreammix" | "streamerx-stream-mix" => {
1032            need_args(
1033                rest,
1034                4,
1035                "set streamerxstreammix <0..N> <wire-name> <kind> <value>",
1036            )?;
1037            let stream: u8 = rest[0]
1038                .parse()
1039                .map_err(|_| format!("streamerx stream mix index not numeric: {}", rest[0]))?;
1040            let value = parse_value(&rest[2..])?;
1041            Ok(Command::SetStreamerXStreamMixParam {
1042                stream,
1043                param: StreamerXStreamMixParam::from_name(rest[1]),
1044                value,
1045            })
1046        }
1047        "rcsyncmix" | "rcsync-mix" => {
1048            need_args(rest, 4, "set rcsyncmix <0..N> <wire-name> <kind> <value>")?;
1049            let mix: u8 = rest[0]
1050                .parse()
1051                .map_err(|_| format!("rcsync mix index not numeric: {}", rest[0]))?;
1052            let value = parse_value(&rest[2..])?;
1053            Ok(Command::SetRcSyncMixParam {
1054                mix,
1055                param: RcSyncMixParam::from_name(rest[1]),
1056                value,
1057            })
1058        }
1059        "mixminuses" | "mix-minuses" => {
1060            need_args(rest, 4, "set mixminuses <0..N> <wire-name> <kind> <value>")?;
1061            let minuses: u8 = rest[0]
1062                .parse()
1063                .map_err(|_| format!("mix minuses index not numeric: {}", rest[0]))?;
1064            let value = parse_value(&rest[2..])?;
1065            Ok(Command::SetMixMinusesParam {
1066                minuses,
1067                param: MixMinusesParam::from_name(rest[1]),
1068                value,
1069            })
1070        }
1071        other => Err(format!("unknown family: {other}")),
1072    }
1073}
Source

pub fn as_str(&self) -> &str

The wire property name for this parameter (inverse of RcSyncMixParam::from_name).

Source

pub fn is_known(&self) -> bool

true if this is a typed variant (not RcSyncMixParam::Other).

Trait Implementations§

Source§

impl Clone for RcSyncMixParam

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RcSyncMixParam

Source§

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

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

impl Display for RcSyncMixParam

Source§

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

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

impl Eq for RcSyncMixParam

Source§

impl Hash for RcSyncMixParam

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RcSyncMixParam

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RcSyncMixParam

Auto Trait Implementations§

Blanket Implementations§

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
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.