#[non_exhaustive]pub struct TurnLimits {
pub max_text_bytes: Option<usize>,
pub max_attachments: Option<usize>,
}Expand description
Size limits on one turn’s input, checked before anything is interpreted.
Both are None by default, which means unlimited. What counts as an
oversized message depends on the product — a chat box and a document upload
are not the same thing — so the library ships no answer and refuses nothing
until a deployment says what it wants refused.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_text_bytes: Option<usize>Maximum length of the user’s text in bytes, or None for no limit.
max_attachments: Option<usize>Maximum number of attachments, or None for no limit.
Implementations§
Source§impl TurnLimits
impl TurnLimits
Sourcepub const fn conservative() -> TurnLimits
pub const fn conservative() -> TurnLimits
No limits at all, which is what ships.
Sourcepub const fn with_max_text_bytes(
self,
max_text_bytes: Option<usize>,
) -> TurnLimits
pub const fn with_max_text_bytes( self, max_text_bytes: Option<usize>, ) -> TurnLimits
Returns a copy with another text limit.
Sourcepub const fn with_max_attachments(
self,
max_attachments: Option<usize>,
) -> TurnLimits
pub const fn with_max_attachments( self, max_attachments: Option<usize>, ) -> TurnLimits
Returns a copy with another attachment limit.
Trait Implementations§
Source§impl Clone for TurnLimits
impl Clone for TurnLimits
Source§fn clone(&self) -> TurnLimits
fn clone(&self) -> TurnLimits
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 moreimpl Copy for TurnLimits
Source§impl Debug for TurnLimits
impl Debug for TurnLimits
Source§impl Default for TurnLimits
impl Default for TurnLimits
Source§fn default() -> TurnLimits
fn default() -> TurnLimits
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TurnLimits
impl<'de> Deserialize<'de> for TurnLimits
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TurnLimits, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TurnLimits, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TurnLimits
Source§impl PartialEq for TurnLimits
impl PartialEq for TurnLimits
Source§impl Serialize for TurnLimits
impl Serialize for TurnLimits
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 TurnLimits
Auto Trait Implementations§
impl Freeze for TurnLimits
impl RefUnwindSafe for TurnLimits
impl Send for TurnLimits
impl Sync for TurnLimits
impl Unpin for TurnLimits
impl UnsafeUnpin for TurnLimits
impl UnwindSafe for TurnLimits
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>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.