Weave documentation
Rust referenceweave-swarm

weave-swarm · topic

Source declarations, signatures and documentation for topic.

Source: sigil/weave/network/weave-swarm/src/topic.rs. SHA-256: 1e49aa703a8bf924b70fd5a14ef1305fc500f8d33ab1ae07fb53b665fb177325.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

topic::TopicId

Topic identifier

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct TopicId(pub [u8; 32]);

Source line: 11.

topic::TopicId::from_bytes

Create topic ID from bytes

pub fn from_bytes(data: &[u8]) -> Self;

Source line: 15.

topic::TopicId::from_text

Create from string bytes.

pub fn from_text(s: &str) -> Self;

Source line: 20.

topic::TopicId::as_bytes

Get the raw bytes

pub fn as_bytes(&self) -> &[u8; 32];

Source line: 25.

topic::TopicState

Topic state

#[derive(Debug)]
pub struct TopicState {
/// Accept incoming connections for this topic

pub server: bool,
/// Make outgoing connections for this topic

pub client: bool,
/// Maximum peers for this topic

pub max_peers: usize,
/// Currently connected peers for this topic

pub active_peers: DashSet<crate::PeerId>,
/// DHT announcement handle

pub announce_handle: Option<JoinHandle<()>>,
/// DHT lookup handle

pub lookup_handle: Option<JoinHandle<()>>
}

Source line: 46.

topic::JoinOptions

Options for joining a topic

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct JoinOptions {
/// Act as server (accept connections)

pub server: Option<bool>,
/// Act as client (make connections)

pub client: Option<bool>,
/// Maximum peers for this topic

pub max_peers: Option<usize>,
/// Priority for connections to this topic

pub priority: Option<u8>
}

Source line: 68.

topic::JoinOptions::server_only

Create server-only options

pub fn server_only() -> Self;

Source line: 84.

topic::JoinOptions::client_only

Create client-only options

pub fn client_only() -> Self;

Source line: 93.

topic::JoinOptions::with_max_peers

Create options with specific max peers

pub fn with_max_peers(max_peers: usize) -> Self;

Source line: 102.

topic::UpdateOptions

Options for updating topic configuration

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UpdateOptions {
/// Update server mode

pub server: Option<bool>,
/// Update client mode

pub client: Option<bool>,
/// Update max peers

pub max_peers: Option<usize>
}

Source line: 112.

On this page