#[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,
pub max_group_chat_members: u32,
pub supported_body_types: &'static [&'static str],
pub server_reserved_body_types: &'static [&'static str],
}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
the count 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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_roles_per_space: u32Maximum number of roles per Space. Enforced against the
resulting count after applying every addRoles entry in a
Space/set update patch.
max_space_members: u32Maximum 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: u32Maximum 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: u32Maximum number of categories per Space. Enforced against the
resulting count after applying every addCategories entry in
a Space/set update patch.
max_group_chat_members: u32Maximum number of members per group Chat. Enforced against the
resulting count after applying every addMembers entry in a
Chat/set update patch.
supported_body_types: &'static [&'static str]bodyType values the account advertises as supportedBodyTypes
and Message/set accepts (draft-atwood-jmap-chat-00
§Account-Level Capability Object). Defaults to
crate::message::SUPPORTED_BODY_TYPES. The list “MUST include
"text/plain" unless the server accepts only end-to-end encrypted
body types”; Message/set rejects a bodyType not listed here,
including the implied "text/plain" of an omitted bodyType.
server_reserved_body_types: &'static [&'static str]Listed types that a companion specification reserves for
server-created Messages (e.g. "application/mimi-fanout",
draft-atwood-jmap-chat-mimi-00). Message/set create rejects
them with an invalidProperties SetError naming bodyType;
update does not. Defaults to empty.
Implementations§
Source§impl ChatLimits
impl ChatLimits
Sourcepub const fn new(
max_roles_per_space: u32,
max_space_members: u32,
max_channels_per_space: u32,
max_categories_per_space: u32,
) -> Self
pub const 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 Space cap fields
specified in declaration order: roles, members, channels,
categories. Self::max_group_chat_members defaults to 1000;
override it with Self::with_max_group_chat_members.
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.
Sourcepub const fn with_max_roles_per_space(self, max: u32) -> Self
pub const fn with_max_roles_per_space(self, max: u32) -> Self
Builder-style setter for Self::max_roles_per_space.
Sourcepub const fn with_max_space_members(self, max: u32) -> Self
pub const fn with_max_space_members(self, max: u32) -> Self
Builder-style setter for Self::max_space_members.
Sourcepub const fn with_max_channels_per_space(self, max: u32) -> Self
pub const fn with_max_channels_per_space(self, max: u32) -> Self
Builder-style setter for Self::max_channels_per_space.
Sourcepub const fn with_max_categories_per_space(self, max: u32) -> Self
pub const fn with_max_categories_per_space(self, max: u32) -> Self
Builder-style setter for Self::max_categories_per_space.
Sourcepub const fn with_max_group_chat_members(self, max: u32) -> Self
pub const fn with_max_group_chat_members(self, max: u32) -> Self
Builder-style setter for Self::max_group_chat_members.
Sourcepub const fn with_supported_body_types(
self,
types: &'static [&'static str],
) -> Self
pub const fn with_supported_body_types( self, types: &'static [&'static str], ) -> Self
Builder-style setter for Self::supported_body_types.
Sourcepub const fn with_server_reserved_body_types(
self,
types: &'static [&'static str],
) -> Self
pub const fn with_server_reserved_body_types( self, types: &'static [&'static str], ) -> Self
Builder-style setter for Self::server_reserved_body_types.