pub struct PromptSegment { /* private fields */ }Expand description
One bounded sourced prompt fragment.
Implementations§
Source§impl PromptSegment
impl PromptSegment
Sourcepub fn new(
id: PromptSegmentId,
content: impl Into<String>,
provenance: PromptProvenance,
trust: TrustLevel,
cache_scope: CacheScope,
budget_behavior: BudgetBehavior,
) -> Result<Self, SegmentError>
pub fn new( id: PromptSegmentId, content: impl Into<String>, provenance: PromptProvenance, trust: TrustLevel, cache_scope: CacheScope, budget_behavior: BudgetBehavior, ) -> Result<Self, SegmentError>
Creates a validated prompt segment.
§Errors
Returns an error for empty, oversized, or null-containing content.
Sourcepub fn with_conflict(self, conflict: ConflictClaim) -> Self
pub fn with_conflict(self, conflict: ConflictClaim) -> Self
Adds a typed conflict claim.
Sourcepub const fn id(&self) -> &PromptSegmentId
pub const fn id(&self) -> &PromptSegmentId
Returns segment identity.
Sourcepub const fn provenance(&self) -> &PromptProvenance
pub const fn provenance(&self) -> &PromptProvenance
Returns source attribution.
Sourcepub const fn trust(&self) -> TrustLevel
pub const fn trust(&self) -> TrustLevel
Returns source trust label.
Sourcepub const fn cache_scope(&self) -> CacheScope
pub const fn cache_scope(&self) -> CacheScope
Returns intended cache scope.
Sourcepub const fn conflict(&self) -> Option<&ConflictClaim>
pub const fn conflict(&self) -> Option<&ConflictClaim>
Returns optional conflict claim.
Sourcepub const fn budget_behavior(&self) -> BudgetBehavior
pub const fn budget_behavior(&self) -> BudgetBehavior
Returns overflow behavior.
Trait Implementations§
Source§impl Clone for PromptSegment
impl Clone for PromptSegment
Source§fn clone(&self) -> PromptSegment
fn clone(&self) -> PromptSegment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromptSegment
impl Debug for PromptSegment
Source§impl<'de> Deserialize<'de> for PromptSegment
impl<'de> Deserialize<'de> for PromptSegment
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PromptSegment
Source§impl Hash for PromptSegment
impl Hash for PromptSegment
Source§impl PartialEq for PromptSegment
impl PartialEq for PromptSegment
Source§impl Serialize for PromptSegment
impl Serialize for PromptSegment
impl StructuralPartialEq for PromptSegment
Auto Trait Implementations§
impl Freeze for PromptSegment
impl RefUnwindSafe for PromptSegment
impl Send for PromptSegment
impl Sync for PromptSegment
impl Unpin for PromptSegment
impl UnsafeUnpin for PromptSegment
impl UnwindSafe for PromptSegment
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