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
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]
[src]
If this update is directly associated with a room, gets the room name.
fn room_name(&self) -> Option<&RoomName>
[src]
If this update is directly associated with a room, gets the room name.
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.
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(&self) -> ChannelUpdate<'a>
[src]
Returns a copy of the value. Read more
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]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more