pub struct ConverterGraph { /* private fields */ }Expand description
Converter graph with deterministic resolver.
use daedalus_data::convert::{ConverterBuilder, ConverterGraph};
use daedalus_data::model::{TypeExpr, Value, ValueType};
let mut graph = ConverterGraph::new();
graph.register(
ConverterBuilder::new(
"bool-id",
TypeExpr::Scalar(ValueType::Bool),
TypeExpr::Scalar(ValueType::Bool),
|v: Value| Ok(v),
)
.build_boxed(),
);
let res = graph.resolve(&TypeExpr::Scalar(ValueType::Bool), &TypeExpr::Scalar(ValueType::Bool));
assert!(res.is_ok());Implementations§
Source§impl ConverterGraph
impl ConverterGraph
Sourcepub fn resolve(
&self,
from: &TypeExpr,
to: &TypeExpr,
) -> DataResult<ConversionResolution>
pub fn resolve( &self, from: &TypeExpr, to: &TypeExpr, ) -> DataResult<ConversionResolution>
Resolve a conversion path using default context.
Sourcepub fn resolve_with_context(
&self,
from: &TypeExpr,
to: &TypeExpr,
active_features: &[String],
allow_gpu: bool,
) -> DataResult<ConversionResolution>
pub fn resolve_with_context( &self, from: &TypeExpr, to: &TypeExpr, active_features: &[String], allow_gpu: bool, ) -> DataResult<ConversionResolution>
Resolve a conversion path with feature/GPU constraints.
Trait Implementations§
Source§impl Default for ConverterGraph
impl Default for ConverterGraph
Source§fn default() -> ConverterGraph
fn default() -> ConverterGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConverterGraph
impl !RefUnwindSafe for ConverterGraph
impl Send for ConverterGraph
impl Sync for ConverterGraph
impl Unpin for ConverterGraph
impl !UnwindSafe for ConverterGraph
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