use std::convert::Infallible;
use super::{context::ConfigureContext, FromContext};
#[derive(Clone, Debug, Hash)]
pub struct Configuration(pub Vec<u8>);
impl Default for Configuration {
fn default() -> Self {
Self("{}".as_bytes().to_vec())
}
}
impl FromContext<ConfigureContext, super::extractability::Transitive> for Configuration {
type Error = Infallible;
fn from_context(context: &ConfigureContext) -> Result<Self, Self::Error> {
Ok(context
.host
.get_plugin_configuration()
.map(Configuration)
.unwrap_or_default())
}
}