Enum screeps_api::websocket::types::ChannelUpdate [] [src]

pub enum ChannelUpdate<'a> {
    RoomMapView {
        room_name: RoomName,
        shard_name: Option<String>,
        update: RoomMapViewUpdate,
    },
    RoomDetail {
        room_name: RoomName,
        shard_name: Option<String>,
        update: RoomUpdate,
    },
    NoRoomDetail {
        room_name: RoomName,
        shard_name: Option<String>,
    },
    UserCpu {
        user_id: Cow<'a, str>,
        update: UserCpuUpdate,
    },
    UserConsole {
        user_id: Cow<'a, str>,
        update: UserConsoleUpdate,
    },
    UserCredits {
        user_id: Cow<'a, str>,
        update: f64,
    },
    UserMessage {
        user_id: Cow<'a, str>,
        update: MessageUpdate,
    },
    UserConversation {
        user_id: Cow<'a, str>,
        target_user_id: Cow<'a, str>,
        update: ConversationUpdate,
    },
    Other {
        channel: Cow<'a, str>,
        update: Value,
    },
}

An update to a Screeps server 'channel' that has been subscribed to.

Variants

A 'map view' update of a room. Sent once per tick.

Fields of RoomMapView

The name of the room this is an update for.

The shard the room is in, if any.

The data: the positions and nondescript types of entities in this room.

An update of objects in a room. Sent once per tick for up to 2 rooms per account. Other subscribed rooms receive ChannelUpdate::NoRoomDetail instead.

Fields of RoomDetail

The name of the room this is an update for.

The shard the room is in, if any.

The data: all properties of all objects in this room that have changed since the last tick.

An update/error received for room detail subscriptions which will not receive an update this tick.

This is due to screeps having a 2-room subscription limit. If more are subscribed globally (per-account, not per-connection) then only 2 receive actual updates.

TODO: This should have a better name, and possibly be incorporated into ChannelUpdate::RoomDetail.

Fields of NoRoomDetail

The name of the room this is a notification for.

The shard the room is in, if any.

An update on the last tick's CPU and memory usage. Sent once per tick.

Fields of UserCpu

The user ID this is a cpu/memory update for.

The update.

An update on all user script log messages last tick or a specific error message. Sent once and exactly once per tick unless:

  • Multiple script errors occurred.
  • Normal log messages were sent and a script error also occurred.

In either of these cases, two or more of these updates will occur in short succession.

Fields of UserConsole

The user ID this console update is for.

The update.

An update on the user's credit total at the end of the last tick. Sent once per tick.

Fields of UserCredits

The user ID this credit update is for.

The number of credits.

An update on a new message received by a user. Sent each time a user receives a message.

Fields of UserMessage

The user ID this message update is for.

The message update.

An update on a change in a conversation the user is participating in. Sent each time either this user or the user or the respondent either sends a message, or reads a previously unread message.

Fields of UserConversation

The user ID of the subscribed user this update is for.

The user ID of the other user in the conversation.

The message update.

Another update that was not accounted for.

TODO: when we're sure of everything, remove this variant.

Fields of Other

The string describing what channel this is.

The update.

Methods

impl<'a> ChannelUpdate<'a>
[src]

[src]

If this update is directly associated with a room, gets the room name.

[src]

If this update is directly associated with a room, gets the room name.

[src]

If this update is directly associated with a subscribed user id, gets the user id.

The user_id is always the user id of the subscribed user, never another associated id.

For example, with 'message' updates, this is the user ID of the user receiving the notification, not the user id of the sender.

[src]

Gets the channel which this update is from.

This channel specification can be used to subscribe or unsubscribe from this channel if needed.

Trait Implementations

impl<'a> Clone for ChannelUpdate<'a>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> Debug for ChannelUpdate<'a>
[src]

[src]

Formats the value using the given formatter.

impl<'de> Deserialize<'de> for ChannelUpdate<'static>
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more