RootBuilder

Struct RootBuilder 

Source
pub struct RootBuilder { /* private fields */ }
Expand description

Builder for creating root configurations at runtime

Implementations§

Source§

impl RootBuilder

Source

pub fn new(uri: impl Into<String>) -> Self

Create a new root builder with the given URI

Source

pub fn from_path(path: impl Into<PathBuf>) -> Self

Create a root builder from a file path (automatically converts to file:// URI)

Source

pub fn name(self, name: impl Into<String>) -> Self

Set the human-readable name for this root

Source

pub fn description(self, description: impl Into<String>) -> Self

Set the description for this root

Source

pub fn meta(self, meta: HashMap<String, Value>) -> Self

Set meta information

Source

pub fn meta_value(self, key: impl Into<String>, value: Value) -> Self

Add a meta key-value pair

Source

pub fn read_only(self, read_only: bool) -> Self

Set whether this root is read-only (default: true for safety)

Source

pub fn read_write(self) -> Self

Allow read and write access (convenience method)

Source

pub fn max_depth(self, depth: usize) -> Self

Set maximum directory traversal depth

Source

pub fn allowed_extensions(self, extensions: Vec<String>) -> Self

Set allowed file extensions (None means all extensions allowed)

Source

pub fn allow_extension(self, extension: impl Into<String>) -> Self

Add an allowed file extension

Source

pub fn excluded_patterns(self, patterns: Vec<String>) -> Self

Set excluded file patterns (glob-style patterns)

Source

pub fn exclude_pattern(self, pattern: impl Into<String>) -> Self

Add an excluded file pattern

Source

pub fn tags(self, tags: Vec<String>) -> Self

Set tags for this root

Source

pub fn tag(self, tag: impl Into<String>) -> Self

Add a tag

Source

pub fn build(self) -> Result<DynamicRoot, String>

Build the dynamic root configuration

Source§

impl RootBuilder

Convenience methods for common root patterns

Source

pub fn source_code_root(path: impl Into<PathBuf>) -> Self

Create a source code root with common file extensions

Source

pub fn docs_root(path: impl Into<PathBuf>) -> Self

Create a documentation root

Source

pub fn config_root(path: impl Into<PathBuf>) -> Self

Create a configuration root

Source

pub fn workspace_root(path: impl Into<PathBuf>) -> Self

Create a temporary workspace root with write access

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.