pub struct SystemBlock {
pub text: String,
pub cache_control: Option<CacheControl>,
}Expand description
One text block in a structured system prompt.
Serializes to the Anthropic API shape {"type":"text","text":"..."}, plus a
cache_control entry when one is set. Only the text block is modelled, which
mirrors ContentBlock::Text and matches the block the API documents for a
system prompt; any extra field on deserialization is ignored rather than
rejected, so a block that grows new fields still parses.
Fields§
§text: StringThe block text.
cache_control: Option<CacheControl>An optional prompt-cache marker. When set, the API caches the request prefix up to and including this block.
Implementations§
Source§impl SystemBlock
impl SystemBlock
Sourcepub fn text(text: impl Into<String>) -> SystemBlock
pub fn text(text: impl Into<String>) -> SystemBlock
A system text block with no cache marker.
Sourcepub fn with_cache_control(self, cache_control: CacheControl) -> SystemBlock
pub fn with_cache_control(self, cache_control: CacheControl) -> SystemBlock
Attach a cache-control marker to this block.
Trait Implementations§
Source§impl Clone for SystemBlock
impl Clone for SystemBlock
Source§fn clone(&self) -> SystemBlock
fn clone(&self) -> SystemBlock
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 SystemBlock
impl Debug for SystemBlock
Source§impl<'de> Deserialize<'de> for SystemBlock
impl<'de> Deserialize<'de> for SystemBlock
Source§fn deserialize<D>(
deserializer: D,
) -> Result<SystemBlock, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SystemBlock, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SystemBlock
impl PartialEq for SystemBlock
Source§impl Serialize for SystemBlock
impl Serialize for SystemBlock
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
impl StructuralPartialEq for SystemBlock
Auto Trait Implementations§
impl Freeze for SystemBlock
impl RefUnwindSafe for SystemBlock
impl Send for SystemBlock
impl Sync for SystemBlock
impl Unpin for SystemBlock
impl UnsafeUnpin for SystemBlock
impl UnwindSafe for SystemBlock
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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