noodles_gff/
directive_buf.rspub mod key;
pub mod value;
use crate::Directive;
pub use self::value::Value;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DirectiveBuf {
key: String,
value: Option<Value>,
}
impl DirectiveBuf {
pub fn new<K>(key: K, value: Option<Value>) -> Self
where
K: Into<String>,
{
Self {
key: key.into(),
value,
}
}
pub fn key(&self) -> &str {
&self.key
}
pub fn value(&self) -> Option<&Value> {
self.value.as_ref()
}
}
impl From<Directive<'_>> for DirectiveBuf {
fn from(directive: Directive<'_>) -> Self {
Self::new(directive.key(), directive.value().map(Value::from))
}
}