pub struct SchemaRegistry { /* private fields */ }Expand description
Registry of compiled schemas for looking up by file extension.
Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
pub fn new() -> Self
Sourcepub fn load_yaml(&mut self, yaml: &str) -> Result<()>
pub fn load_yaml(&mut self, yaml: &str) -> Result<()>
Load and compile a schema from a YAML string.
Sourcepub fn load_file(&mut self, path: &Path) -> Result<()>
pub fn load_file(&mut self, path: &Path) -> Result<()>
Load and compile a schema from a YAML file.
Sourcepub fn load_dir(&mut self, dir: &Path) -> Result<usize>
pub fn load_dir(&mut self, dir: &Path) -> Result<usize>
Load all .yaml/.yml schemas from a directory.
Sourcepub fn from_workspace(workspace_root: &Path) -> Result<Self>
pub fn from_workspace(workspace_root: &Path) -> Result<Self>
Load all workspace schemas from the default config directory.
Sourcepub fn find_by_extension(&self, ext: &str) -> Option<&CompiledSchema>
pub fn find_by_extension(&self, ext: &str) -> Option<&CompiledSchema>
Find a compiled schema by file extension.
Sourcepub fn fallback_file_patterns(&self) -> Vec<(String, String)>
pub fn fallback_file_patterns(&self) -> Vec<(String, String)>
Glob patterns for extensions handled only by SLS, preserving built-in precedence.
Trait Implementations§
Source§impl Debug for SchemaRegistry
impl Debug for SchemaRegistry
Source§impl Default for SchemaRegistry
impl Default for SchemaRegistry
Source§fn default() -> SchemaRegistry
fn default() -> SchemaRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin for SchemaRegistry
impl UnsafeUnpin for SchemaRegistry
impl UnwindSafe for SchemaRegistry
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
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more