Struct lychee_lib::Input
source · pub struct Input {
pub source: InputSource,
pub file_type_hint: Option<FileType>,
pub excluded_paths: Option<Vec<PathBuf>>,
}Expand description
Lychee Input with optional file hint for parsing
Fields§
§source: InputSourceOrigin of input
file_type_hint: Option<FileType>Hint to indicate which extractor to use
excluded_paths: Option<Vec<PathBuf>>Excluded paths that will be skipped when reading content
Implementations§
source§impl Input
impl Input
sourcepub fn new(
value: &str,
file_type_hint: Option<FileType>,
glob_ignore_case: bool,
excluded_paths: Option<Vec<PathBuf>>
) -> Result<Self>
pub fn new( value: &str, file_type_hint: Option<FileType>, glob_ignore_case: bool, excluded_paths: Option<Vec<PathBuf>> ) -> Result<Self>
Construct a new Input source. In case the input is a glob pattern,
glob_ignore_case decides whether matching files against the glob is
case-insensitive or not
§Errors
Returns an error if the input does not exist (i.e. invalid path) and the input cannot be parsed as a URL.
sourcepub fn get_contents(
self,
skip_missing: bool
) -> impl Stream<Item = Result<InputContent>>
pub fn get_contents( self, skip_missing: bool ) -> impl Stream<Item = Result<InputContent>>
Retrieve the contents from the input
§Errors
Returns an error if the contents can not be retrieved because of an underlying I/O error (e.g. an error while making a network request or retrieving the contents from the file system)
sourcepub fn get_sources(self) -> impl Stream<Item = Result<String>>
pub fn get_sources(self) -> impl Stream<Item = Result<String>>
Retrieve all sources from this input. The output depends on the type of input:
- Remote URLs are returned as is, in their full form
- Filepath Glob Patterns are expanded and each matched entry is returned
- Absolute or relative filepaths are returned as is
- All other input types are not returned
§Errors
Returns an error if the globbing fails with the expanded pattern.
sourcepub async fn path_content<P: Into<PathBuf> + AsRef<Path> + Clone>(
path: P
) -> Result<InputContent>
pub async fn path_content<P: Into<PathBuf> + AsRef<Path> + Clone>( path: P ) -> Result<InputContent>
Trait Implementations§
source§impl PartialEq for Input
impl PartialEq for Input
impl Eq for Input
impl StructuralPartialEq for Input
Auto Trait Implementations§
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.