pub struct RuleIndex {
pub name: String,
pub description: String,
pub paths: Option<Vec<String>>,
pub priority: i32,
pub source: ContentSource,
pub source_type: SourceType,
/* private fields */
}Expand description
Rule index entry - minimal metadata for progressive disclosure.
Contains only metadata needed for system prompt injection.
Full rule content is loaded on-demand via load_content().
Fields§
§name: StringRule name (unique identifier).
description: StringHuman-readable description of what this rule does.
paths: Option<Vec<String>>Path patterns this rule applies to (glob syntax).
None means this is a global rule that applies to all files.
priority: i32Explicit priority for ordering. Higher values take precedence. This is separate from source_type-based priority in the Index trait.
source: ContentSourceContent source for lazy loading.
source_type: SourceTypeSource type (builtin, user, project).
Implementations§
Source§impl RuleIndex
impl RuleIndex
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Create a new rule index entry.
Uses ContentSource::default() (empty InMemory) as placeholder.
Call with_source() to set the actual content source.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the rule description.
Sourcepub fn with_paths(self, paths: Vec<String>) -> Self
pub fn with_paths(self, paths: Vec<String>) -> Self
Set path patterns this rule applies to.
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Set the explicit priority.
Sourcepub fn with_source(self, source: ContentSource) -> Self
pub fn with_source(self, source: ContentSource) -> Self
Set the content source.
Sourcepub fn with_source_type(self, source_type: SourceType) -> Self
pub fn with_source_type(self, source_type: SourceType) -> Self
Set the source type.
Sourcepub fn parse_with_frontmatter(content: &str, path: &Path) -> Option<Self>
pub fn parse_with_frontmatter(content: &str, path: &Path) -> Option<Self>
Parse rule from content with frontmatter.
Uses the generic parse_frontmatter<RuleFrontmatter>() parser.
Falls back to defaults if frontmatter is missing or invalid.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RuleIndex
impl<'de> Deserialize<'de> for RuleIndex
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Index for RuleIndex
impl Index for RuleIndex
Source§fn priority(&self) -> i32
fn priority(&self) -> i32
Override priority to use explicit field instead of source_type-based.
Rules need explicit ordering independent of their source type.
Source§fn source(&self) -> &ContentSource
fn source(&self) -> &ContentSource
Source§fn source_type(&self) -> SourceType
fn source_type(&self) -> SourceType
Source§fn to_summary_line(&self) -> String
fn to_summary_line(&self) -> String
Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for RuleIndex
impl RefUnwindSafe for RuleIndex
impl Send for RuleIndex
impl Sync for RuleIndex
impl Unpin for RuleIndex
impl UnwindSafe for RuleIndex
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
Source§fn deserialize_with(body: ResponseBody) -> Result<D, Error>
fn deserialize_with(body: ResponseBody) -> Result<D, Error>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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>
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