Skip to content

Commit

Permalink
Fix doc's code
Browse files Browse the repository at this point in the history
  • Loading branch information
StemCll committed Jan 5, 2023
1 parent 2c6c65c commit b13b0e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ where
}

/// Creates a [`Behaviour`] struct given a set of parameters specified via a
/// [`BehaviourConfig`]. This has no subscription filter and uses no compression.
/// [`Config`]. This has no subscription filter and uses no compression.
/// Metrics can be evaluated by passing a reference to a [`Registry`].
pub fn new_with_metrics(
privacy: MessageAuthenticity,
Expand All @@ -356,7 +356,7 @@ where
F: TopicSubscriptionFilter,
{
/// Creates a [`Behaviour`] struct given a set of parameters specified via a
/// [`BehaviourConfig`] and a custom subscription filter.
/// [`Config`] and a custom subscription filter.
pub fn new_with_subscription_filter(
privacy: MessageAuthenticity,
config: Config,
Expand Down Expand Up @@ -743,7 +743,7 @@ where
Ok(msg_id)
}

/// This function should be called when [`BehaviourConfig::validate_messages()`] is `true` after
/// This function should be called when [`Config::validate_messages()`] is `true` after
/// the message got validated by the caller. Messages are stored in the ['Memcache'] and
/// validation is expected to be fast enough that the messages should still exist in the cache.
/// There are three possible validation outcomes and the outcome is given in acceptance.
Expand Down Expand Up @@ -1718,7 +1718,7 @@ where
true
}

/// Handles a newly received [`RawBehaviourMessage`].
/// Handles a newly received [`RawMessage`].
///
/// Forwards the message to all peers in the mesh.
fn handle_received_message(
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ impl Builder {

/// When set, prevents automatic forwarding of all received messages. This setting
/// allows a user to validate the messages before propagating them to their peers. If set,
/// the user must manually call [`crate::Gossipsub::report_message_validation_result()`] on the
/// the user must manually call [`crate::Behaviour::report_message_validation_result()`] on the
/// behaviour to forward a message once validated.
pub fn validate_messages(&mut self) -> &mut Self {
self.config.validate_messages = true;
Expand Down
6 changes: 3 additions & 3 deletions protocols/gossipsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@
//! // Create a Swarm to manage peers and events
//! let mut swarm = {
//! // set default parameters for gossipsub
//! let gossipsub_config = libp2p_gossipsub::GossipsubConfig::default();
//! let gossipsub_config = libp2p_gossipsub::config::Config::default();
//! // build a gossipsub network behaviour
//! let mut gossipsub: libp2p_gossipsub::Gossipsub =
//! libp2p_gossipsub::Gossipsub::new(message_authenticity, gossipsub_config).unwrap();
//! let mut gossipsub: libp2p_gossipsub::Behaviour =
//! libp2p_gossipsub::Behaviour::new(message_authenticity, gossipsub_config).unwrap();
//! // subscribe to the topic
//! gossipsub.subscribe(&topic);
//! // create the swarm (use an executor in a real example)
Expand Down

0 comments on commit b13b0e1

Please sign in to comment.