pub struct RulesFile<'a> { /* private fields */ }Expand description
A parsed lean-ctx rules section from a file on disk.
Handles version detection, content boundary discovery, and prefix/suffix extraction. This is the only place that parses rule markers.
Implementations§
Source§impl<'a> RulesFile<'a>
impl<'a> RulesFile<'a>
Sourcepub fn parse(content: &'a str) -> Self
pub fn parse(content: &'a str) -> Self
Parse content, scanning for START_MARK and version comment.
Sourcepub fn has_content(&self) -> bool
pub fn has_content(&self) -> bool
Whether the file carries any lean-ctx rules content.
Sourcepub fn is_current(&self) -> bool
pub fn is_current(&self) -> bool
Whether the file’s version is at least RULES_VERSION.
Sourcepub fn block_matches_render(
&self,
shadow: bool,
wrapper: Wrapper,
level: CompressionLevel,
tool_profile: &ToolProfile,
) -> bool
pub fn block_matches_render( &self, shadow: bool, wrapper: Wrapper, level: CompressionLevel, tool_profile: &ToolProfile, ) -> bool
Whether the on-disk block matches a fresh render.
Sourcepub fn merged(
&self,
shadow: bool,
wrapper: Wrapper,
level: CompressionLevel,
tool_profile: &ToolProfile,
) -> String
pub fn merged( &self, shadow: bool, wrapper: Wrapper, level: CompressionLevel, tool_profile: &ToolProfile, ) -> String
Merge freshly-rendered rules into this file.
Sourcepub fn initial(
shadow: bool,
wrapper: Wrapper,
level: CompressionLevel,
tool_profile: &ToolProfile,
) -> String
pub fn initial( shadow: bool, wrapper: Wrapper, level: CompressionLevel, tool_profile: &ToolProfile, ) -> String
Create initial rules content.
Sourcepub fn without_section(&self) -> String
pub fn without_section(&self) -> String
Strip the lean-ctx section, keeping user content before/after.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for RulesFile<'a>
impl<'a> RefUnwindSafe for RulesFile<'a>
impl<'a> Send for RulesFile<'a>
impl<'a> Sync for RulesFile<'a>
impl<'a> Unpin for RulesFile<'a>
impl<'a> UnsafeUnpin for RulesFile<'a>
impl<'a> UnwindSafe for RulesFile<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§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