pub struct TypesProposedContent {
pub kind: ProposedContentKind,
pub content: String,
pub structured: Option<Value>,
/* private fields */
}Expand description
Content of a proposal.
Fields§
§kind: ProposedContentKindWhat kind of content this is
content: StringThe textual content
structured: Option<Value>Structured content (if applicable)
Implementations§
Source§impl ProposedContent
impl ProposedContent
Sourcepub fn new(
kind: ProposedContentKind,
content: impl Into<String>,
) -> ProposedContent
pub fn new( kind: ProposedContentKind, content: impl Into<String>, ) -> ProposedContent
Create new proposed content.
Sourcepub fn confidence(&self) -> Option<f32>
pub fn confidence(&self) -> Option<f32>
Returns the confidence score if set, always in [0.0, 1.0].
Sourcepub fn with_structured(self, structured: Value) -> ProposedContent
pub fn with_structured(self, structured: Value) -> ProposedContent
Add structured content.
Sourcepub fn with_confidence(self, confidence: f32) -> ProposedContent
pub fn with_confidence(self, confidence: f32) -> ProposedContent
Set a confidence baseline.
The value is clamped to [0.0, 1.0]. Non-finite values are treated as 0.0.
Use adjust_confidence to accumulate criteria on top.
Sourcepub fn adjust_confidence(self, delta: f32) -> ProposedContent
pub fn adjust_confidence(self, delta: f32) -> ProposedContent
Adjust confidence by a delta, clamped to [0.0, 1.0].
If no confidence has been set, the delta is applied from 0.0.
Trait Implementations§
Source§impl Clone for ProposedContent
impl Clone for ProposedContent
Source§fn clone(&self) -> ProposedContent
fn clone(&self) -> ProposedContent
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 ProposedContent
impl Debug for ProposedContent
Source§impl<'de> Deserialize<'de> for ProposedContent
impl<'de> Deserialize<'de> for ProposedContent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProposedContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProposedContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ProposedContent
impl Serialize for ProposedContent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ProposedContent
impl RefUnwindSafe for ProposedContent
impl Send for ProposedContent
impl Sync for ProposedContent
impl Unpin for ProposedContent
impl UnsafeUnpin for ProposedContent
impl UnwindSafe for ProposedContent
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