pub struct ContentSection {
pub title: String,
pub content: String,
pub priority: u8,
pub truncated: bool,
}Expand description
A content section with associated metadata for prioritization.
Represents a section of content (like project metadata, source code, or documentation) with a title, content, priority level, and truncation status.
§Priority Levels
9-10: High priority (metadata, documentation)5-6: Medium priority (AST analysis, structure)1-2: Low priority (source code)
§Examples
use ai_context_gen::token_counter::ContentSection;
// Create a high-priority section
let section = ContentSection::high_priority(
"Project Metadata".to_string(),
"Important project information...".to_string()
);
// Create a custom priority section
let custom = ContentSection::new(
"Custom Section".to_string(),
"Content here...".to_string(),
7
);Fields§
§title: StringTitle of the content section.
content: StringThe actual content of the section.
priority: u8Priority level (higher numbers = higher priority).
truncated: boolWhether this section was truncated to fit token limits.
Implementations§
Source§impl ContentSection
impl ContentSection
Sourcepub fn new(title: String, content: String, priority: u8) -> Self
pub fn new(title: String, content: String, priority: u8) -> Self
Creates a new content section with the specified priority.
§Arguments
title- Display title for the sectioncontent- The content textpriority- Priority level (0-255, higher is more important)
§Examples
use ai_context_gen::token_counter::ContentSection;
let section = ContentSection::new(
"My Section".to_string(),
"Section content...".to_string(),
8
);Sourcepub fn high_priority(title: String, content: String) -> Self
pub fn high_priority(title: String, content: String) -> Self
Creates a high-priority content section (priority 9).
Use for critical content like project metadata and documentation that should always be included.
§Arguments
title- Display title for the sectioncontent- The content text
Sourcepub fn medium_priority(title: String, content: String) -> Self
pub fn medium_priority(title: String, content: String) -> Self
Creates a medium-priority content section (priority 5).
Use for structural information like AST analysis and project organization.
§Arguments
title- Display title for the sectioncontent- The content text
Sourcepub fn low_priority(title: String, content: String) -> Self
pub fn low_priority(title: String, content: String) -> Self
Creates a low-priority content section (priority 1).
Use for detailed content like complete source code that can be truncated if necessary.
§Arguments
title- Display title for the sectioncontent- The content text
Trait Implementations§
Source§impl Clone for ContentSection
impl Clone for ContentSection
Source§fn clone(&self) -> ContentSection
fn clone(&self) -> ContentSection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more