Enum quilkin::config::ConfigType
source · pub enum ConfigType {
Static(Value),
Dynamic(Any),
}
Expand description
The configuration of a Filter
from either a
static or dynamic source.
Variants§
Implementations§
source§impl ConfigType
impl ConfigType
sourcepub fn deserialize<TextConfiguration, BinaryConfiguration>(
self,
filter_name: &str
) -> Result<(Value, TextConfiguration), CreationError>where
BinaryConfiguration: Message + Default,
TextConfiguration: Serialize + for<'de> Deserialize<'de> + TryFrom<BinaryConfiguration>,
CreationError: From<<BinaryConfiguration as TryInto<TextConfiguration>>::Error>,
pub fn deserialize<TextConfiguration, BinaryConfiguration>(
self,
filter_name: &str
) -> Result<(Value, TextConfiguration), CreationError>where
BinaryConfiguration: Message + Default,
TextConfiguration: Serialize + for<'de> Deserialize<'de> + TryFrom<BinaryConfiguration>,
CreationError: From<<BinaryConfiguration as TryInto<TextConfiguration>>::Error>,
Deserializes takes two type arguments Static
and Dynamic
representing
the types of a static and dynamic configuration respectively.
If the configuration input is a ConfigType::Static, then it is directly
deserialized into the returned Static
instance.
Otherwise if the input is a ConfigType::Dynamic then the contained Protobuf
data is decoded into a type Dynamic
instance, after which the decoded
value is converted into the returned Static
instance.
As a result TryFrom must be implemented from the Dynamic
to the Static
type.
It returns both the deserialized, as well as, a JSON representation of the provided config. It returns an error if any of the serialization or deserialization steps fail.
Trait Implementations§
source§impl Clone for ConfigType
impl Clone for ConfigType
source§fn clone(&self) -> ConfigType
fn clone(&self) -> ConfigType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ConfigType
impl Debug for ConfigType
source§impl<'de> Deserialize<'de> for ConfigType
impl<'de> Deserialize<'de> for ConfigType
source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl From<Value> for ConfigType
impl From<Value> for ConfigType
source§impl JsonSchema for ConfigType
impl JsonSchema for ConfigType
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl PartialEq for ConfigType
impl PartialEq for ConfigType
source§fn eq(&self, other: &ConfigType) -> bool
fn eq(&self, other: &ConfigType) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ConfigType
impl Serialize for ConfigType
impl StructuralPartialEq for ConfigType
Auto Trait Implementations§
impl RefUnwindSafe for ConfigType
impl Send for ConfigType
impl Sync for ConfigType
impl Unpin for ConfigType
impl UnwindSafe for ConfigType
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request