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

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

RoomMapView

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

Fields of RoomMapView

room_name: RoomName

The name of the room this is an update for.

shard_name: Option<String>

The shard the room is in, if any.

update: RoomMapViewUpdate

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

RoomDetail

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

room_name: RoomName

The name of the room this is an update for.

shard_name: Option<String>

The shard the room is in, if any.

update: RoomUpdate

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

NoRoomDetail

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

room_name: RoomName

The name of the room this is a notification for.

shard_name: Option<String>

The shard the room is in, if any.

UserCpu

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

Fields of UserCpu

user_id: Cow<'a, str>

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

update: UserCpuUpdate

The update.

UserConsole

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

user_id: Cow<'a, str>

The user ID this console update is for.

update: UserConsoleUpdate

The update.

UserCredits

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

Fields of UserCredits

user_id: Cow<'a, str>

The user ID this credit update is for.

update: f64

The number of credits.

UserMessage

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

Fields of UserMessage

user_id: Cow<'a, str>

The user ID this message update is for.

update: MessageUpdate

The message update.

UserConversation

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

user_id: Cow<'a, str>

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

target_user_id: Cow<'a, str>

The user ID of the other user in the conversation.

update: ConversationUpdate

The message update.

Other

Another update that was not accounted for.

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

Fields of Other

channel: Cow<'a, str>

The string describing what channel this is.

update: Value

The update.

Methods

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

pub fn shard_name(&self) -> Option<&str>[src]

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

pub fn room_name(&self) -> Option<&RoomName>[src]

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

pub fn user_id(&self) -> Option<&str>[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.

pub fn channel(&self) -> Channel[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]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

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

Auto Trait Implementations

impl<'a> Unpin for ChannelUpdate<'a>

impl<'a> Send for ChannelUpdate<'a>

impl<'a> Sync for ChannelUpdate<'a>

impl<'a> UnwindSafe for ChannelUpdate<'a>

impl<'a> RefUnwindSafe for ChannelUpdate<'a>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,