Creating Associations

Associations are created on a MasterChannel by specifying some configuration and callback interfaces.

let mut association = channel
.add_association(
EndpointAddress::from(1024)?,
get_association_config(),
NullReadHandler::boxed(),
DefaultAssociationHandler::boxed(),
)
.await?;
note

The Rust API and the binding APIs differ with regard to associations. In the bindings, an association token is returned which is then used on the channel. In the Rust API, an object is returned which has its own methods for performing operations on the association.

The AssociationId struct returned when adding an association is just a token. It is needed to perform operations on a particular outstation on the channel, but unlike the MasterChannel, you don't need to worry about keeping a reference to it around if its not needed. Allowing the AssociationId to be garbage collected won't cause the association to be removed from the channel.

Removing#

Associations may also be removed from a channel by calling MasterChannel.removeAssociation and passing in the AssociationId.