Enum sesstype::local::Type [] [src]

pub enum Type {
    Branch {
        p: Rc<Role>,
        s: HashMap<Message, Box<Type>>,
    },
    Select {
        p: Rc<Role>,
        s: HashMap<Message, Box<Type>>,
    },
    Recur {
        t: String,
        s: Box<Type>,
    },
    TypeVar {
        t: String,
    },
    End,
}

Local session types.

Definition 2.5

S ::= p &ᵢ ? lᵢ(Uᵢ).Sᵢ where i ∈ I | p ⊕ᵢ ! lᵢ(Uᵢ).Sᵢ where i ∈ I | μt.S | t | end

Variants

Branching Type receives a Message chosen by a Role.

S ::= p &ᵢ ? lᵢ(Uᵢ).Sᵢ where i ∈ I

p is the receiver Role, and s is the mapping of Message to continuation Type choices.

Each map entry represents a choice received by q, where the key of s (a Message) is the message expected, and the value is the continuation Type of the Branching Type.

Fields of Branch

Selection Type sends a Message chosen by a Role.

S ::= p ⊕ᵢ ! lᵢ(Uᵢ).Sᵢ where i ∈ I

p is the sender Role, and s is the mapping of Message to continuation Type choices.

Each map entry represents a choice sent by p, where the key of s (a Message) is the message to send, and the value is the continuation Type of the Selection Type.

Fields of Select

Recursive Type for representing infinite behaviour.

S ::= μt.S

t is the type variable for identifying the recursion, and s is the Type for the continuation.

Fields of Recur

Type Variable for use with Recur to represent infinite behaviour.

S ::= t

t is the previously defined type variable in Recur.

Fields of TypeVar

Terminated Type with no continuation.

G ::= end

Methods

impl Type
[src]

[src]

Returns a heap-allocated Type::Branch with no interactions.

p is the receiver Role.

[src]

Returns a heap-allocated Type::Select with no interactions.

p is the sender Role.

[src]

Adds a message m_i (and its continuation s_i) to a Type::Branch or Type::Select and returns the updated Branch Type or Select Type respectively.

selbr_type is the input Type, if it is not a Type::Branch or Type::Select it is returned unmodified.

[src]

Returns the number of branches/selects for the Type::Branch/Type::Select.

Returns 1 for other Type variants (1 continuation).

[src]

Returns a heap-allocated Type::Recur.

name is the name given to the recursion scope. body is the recursion body.

[src]

Returns a heap-allocated Type::TypeVar.

name is the (previously defined) name of the recursion scope.

[src]

Returns a heap-allocated Type::End.

All types should end in an instance of this (or TypeVar).

[src]

Deep-compares two local types.

This compare considers two types the same if the role names (references) are identical, and Type is structurally equivalent.

Trait Implementations

impl Debug for Type
[src]

[src]

Formats the value using the given formatter.

impl ToString for Type
[src]

[src]

Converts the given value to a String. Read more

impl PartialEq for Type
[src]

[src]

Returns true if two local::Type are structurally equivalent.

Roles are considered the same if their String name are equal, as this is the more common use of equality in this library. For equality where Roles are identical references, use the deep_eq() method.

1.0.0
[src]

This method tests for !=.