Skip to main content

ChatLimits

Struct ChatLimits 

Source
#[non_exhaustive]
pub struct ChatLimits { pub max_roles_per_space: u32, pub max_space_members: u32, pub max_channels_per_space: u32, pub max_categories_per_space: u32, }
Expand description

Implementation-defined per-Space content limits enforced by Space/set handlers.

Per draft-atwood-jmap-chat-00 §Space/set (spec commit 80d5e11, 2026-05-11), each add* op on a Space MUST return an overQuota SetError (RFC 8620 §5.3) when the resulting count would exceed a server-defined limit. The spec does not name or normatively define the cap values; they are implementation-defined and may vary per account or per tenant.

Backends override ChatBackend::limits to supply their own values. The default impl returns conservative reference-impl-grade values suitable for tests and single-tenant dev servers; production deployments are expected to override.

Client visibility of these caps (when desired) is via JMAP Quotas (urn:ietf:params:jmap:quotas, RFC 9425), not via this struct. The urn:ietf:params:jmap:chat session capability does NOT advertise these caps (the previous cap-advertising fields maxRolesPerSpace, maxSpaceMembers, maxChannelsPerSpace, maxCategoriesPerSpace were removed from the draft in spec commit 80d5e11).

See the workspace AGENTS.md “Backend caps and limits” section for the cross-extension pattern this struct establishes for JMAP Chat.

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_roles_per_space: u32

Maximum number of roles per Space. Enforced against the resulting count after applying every addRoles entry in a Space/set update patch.

§max_space_members: u32

Maximum number of members per Space. Enforced against the resulting count after applying every addMembers entry in a Space/set update patch.

§max_channels_per_space: u32

Maximum number of channels per Space. Enforced against the resulting count after applying every addChannels entry in a Space/set update patch. The current channel count is the sum of space.uncategorizedChannelIds.len() and every space.categories[].channelIds.len().

§max_categories_per_space: u32

Maximum number of categories per Space. Enforced against the resulting count after applying every addCategories entry in a Space/set update patch.

Implementations§

Source§

impl ChatLimits

Source

pub fn new( max_roles_per_space: u32, max_space_members: u32, max_channels_per_space: u32, max_categories_per_space: u32, ) -> Self

Construct a ChatLimits with the four cap fields specified in declaration order: roles, members, channels, categories.

The struct is #[non_exhaustive] so external callers (tests using MemoryBackend::set_limits_for_test, production backends overriding ChatBackend::limits) need a constructor to build one. Future cap-field additions to ChatLimits are an additive non-breaking change because the constructor stays stable; callers wanting to override the new field combine ChatLimits::new(..) with Self::with_max_roles_per_space / Self::with_max_space_members / Self::with_max_channels_per_space / Self::with_max_categories_per_space and a future analogous setter.

Source

pub fn with_max_roles_per_space(self, max: u32) -> Self

Builder-style setter for Self::max_roles_per_space.

Source

pub fn with_max_space_members(self, max: u32) -> Self

Builder-style setter for Self::max_space_members.

Source

pub fn with_max_channels_per_space(self, max: u32) -> Self

Builder-style setter for Self::max_channels_per_space.

Source

pub fn with_max_categories_per_space(self, max: u32) -> Self

Builder-style setter for Self::max_categories_per_space.

Trait Implementations§

Source§

impl Clone for ChatLimits

Source§

fn clone(&self) -> ChatLimits

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChatLimits

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChatLimits

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ChatLimits

Source§

fn eq(&self, other: &ChatLimits) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ChatLimits

Source§

impl Eq for ChatLimits

Source§

impl StructuralPartialEq for ChatLimits

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.