#[non_exhaustive]pub struct Content {
pub bytes: Vec<u8>,
pub text: String,
pub language: Language,
pub path: PathBuf,
}Expand description
A source file’s bytes, decoded text, detected language and path.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.bytes: Vec<u8>The file’s raw bytes, after any Helm-template fixup.
text: Stringbytes, lossily decoded as UTF-8.
language: LanguageThe language detected from the file’s extension.
path: PathBufThe file’s path, as given to Content::from_path.
Implementations§
Source§impl Content
impl Content
Sourcepub fn from_path(path: &Path, max_size: Option<u64>) -> Option<Self>
pub fn from_path(path: &Path, max_size: Option<u64>) -> Option<Self>
Loads and language-detects the file at path, applying any Helm
fixup and custom parser transform its content needs.
Returns None for an unsupported extension, a file over max_size
bytes (defaults to 500 KiB), or one that cannot be read.
Trait Implementations§
impl Eq for Content
impl StructuralPartialEq for Content
Auto Trait Implementations§
impl Freeze for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnsafeUnpin for Content
impl UnwindSafe for Content
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.