pub struct BindingLoader;Expand description
Loads .binding.yaml files into ScannedModule objects.
§Usage
ⓘ
let loader = BindingLoader;
let modules = loader.load(Path::new("bindings/"), false, false)?;
let strict = loader.load(Path::new("foo.binding.yaml"), true, false)?;In loose mode (strict=false, default), only module_id and target
are required; missing optional fields fall back to defaults.
In strict mode (strict=true), input_schema and output_schema are
additionally required.
Implementations§
Source§impl BindingLoader
impl BindingLoader
Sourcepub fn load(
&self,
path: &Path,
strict: bool,
recursive: bool,
) -> Result<Vec<ScannedModule>, BindingLoadError>
pub fn load( &self, path: &Path, strict: bool, recursive: bool, ) -> Result<Vec<ScannedModule>, BindingLoadError>
Load one file or every *.binding.yaml in a directory.
When recursive is true, subdirectories are traversed depth-first using
walkdir. When false (default), only the immediate directory is scanned.
Sourcepub fn load_data(
&self,
data: &Value,
strict: bool,
) -> Result<Vec<ScannedModule>, BindingLoadError>
pub fn load_data( &self, data: &Value, strict: bool, ) -> Result<Vec<ScannedModule>, BindingLoadError>
Parse a pre-loaded binding JSON value ({"bindings": [...]}).
Trait Implementations§
Source§impl Debug for BindingLoader
impl Debug for BindingLoader
Source§impl Default for BindingLoader
impl Default for BindingLoader
Source§fn default() -> BindingLoader
fn default() -> BindingLoader
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BindingLoader
impl RefUnwindSafe for BindingLoader
impl Send for BindingLoader
impl Sync for BindingLoader
impl Unpin for BindingLoader
impl UnsafeUnpin for BindingLoader
impl UnwindSafe for BindingLoader
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