pub struct StreamConfig {
pub stream_name: String,
pub stream_type: String,
pub config: Value,
}Expand description
The config for one Stream of a type advertised by this plugin.
For example this user config:
{
streams: {
mystream: {
type: "mystreamtype",
options: {
key: "value",
num: 3,
},
// filters: ...
},
},
}would result in the following StreamConfig:
StreamConfig {
stream_name: "mystream",
stream_type: "mystreamtype",
config: Value::Object(BTreeMap::from([
("key", Value::String("value")),
("num", Value::Integer(3)),
])),
}Don’t hesitate to take advantage of serde_json::from_value, to deserialize the Value into a Rust struct:
#[derive(Deserialize)]
struct MyStreamOptions {
key: String,
num: i64,
}
fn validate_config(stream_config: Value) -> Result<MyStreamOptions, serde_json::Error> {
serde_json::from_value(stream_config.into())
}Fields§
§stream_name: String§stream_type: String§config: ValueTrait Implementations§
Source§impl Clone for StreamConfig
impl Clone for StreamConfig
Source§fn clone(&self) -> StreamConfig
fn clone(&self) -> StreamConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de> Deserialize<'de> for StreamConfig
impl<'de> Deserialize<'de> for StreamConfig
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 StreamConfig
impl RefUnwindSafe for StreamConfig
impl Send for StreamConfig
impl Sync for StreamConfig
impl Unpin for StreamConfig
impl UnwindSafe for StreamConfig
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