pub struct DescriptorBuilder { /* private fields */ }Expand description
Builder to construct descriptors with deterministic ordering.
use daedalus_data::descriptor::{DescriptorBuilder, GpuHints, MemoryLocation};
use daedalus_data::errors::DataResult;
use daedalus_data::model::{TypeExpr, Value, ValueType};
fn build_descriptor() -> DataResult<()> {
let desc = DescriptorBuilder::new("example", "1.0.0")
.label("Example")
.settable(true)
.type_expr(TypeExpr::Scalar(ValueType::String))
.default(Value::String("hi".into()))
.codec("json")
.feature_flag("core")
.gpu_hints(GpuHints { requires_gpu: false, preferred_memory: Some(MemoryLocation::Host) })
.build()?;
assert_eq!(desc.codecs, vec!["json"]);
Ok(())
}Implementations§
Source§impl DescriptorBuilder
impl DescriptorBuilder
pub fn new(id: impl Into<String>, version: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
pub fn settable(self, settable: bool) -> Self
pub fn default(self, default: Value) -> Self
pub fn schema(self, schema: impl Into<String>) -> Self
pub fn codec(self, codec: impl Into<String>) -> Self
pub fn converter(self, conv: impl Into<String>) -> Self
pub fn feature_flag(self, flag: impl Into<String>) -> Self
pub fn gpu_hints(self, hints: GpuHints) -> Self
pub fn type_expr(self, ty: TypeExpr) -> Self
pub fn build(self) -> DataResult<DataDescriptor>
Auto Trait Implementations§
impl Freeze for DescriptorBuilder
impl RefUnwindSafe for DescriptorBuilder
impl Send for DescriptorBuilder
impl Sync for DescriptorBuilder
impl Unpin for DescriptorBuilder
impl UnwindSafe for DescriptorBuilder
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