#[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() -> Self
pub const fn conservative() -> Self
No limits at all, which is what ships.
Sourcepub const fn with_max_text_bytes(self, max_text_bytes: Option<usize>) -> Self
pub const fn with_max_text_bytes(self, max_text_bytes: Option<usize>) -> Self
Returns a copy with another text limit.
Sourcepub const fn with_max_attachments(self, max_attachments: Option<usize>) -> Self
pub const fn with_max_attachments(self, max_attachments: Option<usize>) -> Self
Returns a copy with another attachment limit.
Trait Implementations§
Source§impl Clone for TurnLimits
impl Clone for TurnLimits
impl Copy for TurnLimits
Source§impl Debug for TurnLimits
impl Debug for TurnLimits
Source§impl Default for TurnLimits
impl Default for TurnLimits
Source§impl<'de> Deserialize<'de> for TurnLimits
impl<'de> Deserialize<'de> for TurnLimits
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 TurnLimits
Source§impl PartialEq for TurnLimits
impl PartialEq for TurnLimits
Source§impl Serialize for TurnLimits
impl Serialize for TurnLimits
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.