pdk_classy/extract/
config.rs1use std::convert::Infallible;
8
9use super::{context::ConfigureContext, FromContext};
10
11#[derive(Clone, Debug, Hash)]
12pub struct Configuration(pub Vec<u8>);
14
15impl Default for Configuration {
16 fn default() -> Self {
17 Self("{}".as_bytes().to_vec())
18 }
19}
20
21impl FromContext<ConfigureContext> for Configuration {
22 type Error = Infallible;
23
24 fn from_context(context: &ConfigureContext) -> Result<Self, Self::Error> {
25 Ok(context
26 .host
27 .get_plugin_configuration()
28 .map(Configuration)
29 .unwrap_or_default())
30 }
31}