pub struct TopicDescriptor {
pub topic_name: &'static str,
pub keyed_by: Option<&'static str>,
pub schema_json: &'static str,
pub delivery: DeliveryMode,
pub shard_config: Option<ShardConfig>,
}Expand description
Descriptor for a registered topic (from #[photon::topic] macro).
Used for runtime lookup and schema metadata.
Fields§
§topic_name: &'static strStable topic name (e.g., “user.notifications”).
keyed_by: Option<&'static str>Optional key field name.
schema_json: &'static strReserved JSON schema metadata placeholder.
Currently always "{}" from #[photon::topic]. Not validated at publish time;
do not infer schema enforcement from this field.
delivery: DeliveryModePublish routing mode (broadcast default).
shard_config: Option<ShardConfig>Virtual shard settings when DeliveryMode::ConsumerGroup.
Implementations§
Source§impl TopicDescriptor
impl TopicDescriptor
Sourcepub const fn new(
topic_name: &'static str,
keyed_by: Option<&'static str>,
schema_json: &'static str,
) -> Self
pub const fn new( topic_name: &'static str, keyed_by: Option<&'static str>, schema_json: &'static str, ) -> Self
Create a broadcast topic descriptor (default delivery mode).
Sourcepub const fn group(
topic_name: &'static str,
shard_count: u32,
shard_by: Option<&'static str>,
schema_json: &'static str,
) -> Self
pub const fn group( topic_name: &'static str, shard_count: u32, shard_by: Option<&'static str>, schema_json: &'static str, ) -> Self
Create a consumer-group topic with virtual shard routing.
Sourcepub fn is_consumer_group(&self) -> bool
pub fn is_consumer_group(&self) -> bool
Whether publishes route to virtual shard streams.
Sourcepub fn schema_value(&self) -> Option<Value>
pub fn schema_value(&self) -> Option<Value>
Get schema as parsed JSON.
Trait Implementations§
Source§impl Clone for TopicDescriptor
impl Clone for TopicDescriptor
Source§fn clone(&self) -> TopicDescriptor
fn clone(&self) -> TopicDescriptor
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 Collect for TopicDescriptor
Source§impl Debug for TopicDescriptor
impl Debug for TopicDescriptor
Source§impl Registrable for TopicDescriptor
impl Registrable for TopicDescriptor
Source§fn registry_key(&self) -> &str
fn registry_key(&self) -> &str
Return the unique lookup key used by the registry.
Auto Trait Implementations§
impl Freeze for TopicDescriptor
impl RefUnwindSafe for TopicDescriptor
impl Send for TopicDescriptor
impl Sync for TopicDescriptor
impl Unpin for TopicDescriptor
impl UnsafeUnpin for TopicDescriptor
impl UnwindSafe for TopicDescriptor
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