#[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
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.
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 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.
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.