pub struct Channel {
pub ship_interface: ShipInterface,
pub uid: String,
pub url: String,
pub subscription_list: Vec<Subscription>,
pub message_id_count: u64,
/* private fields */
}
Expand description
A Channel which is used to interact with a ship
Fields§
§ship_interface: ShipInterface
ShipInterface
this channel is created from
uid: String
The uid of the channel
url: String
The url of the channel
subscription_list: Vec<Subscription>
§message_id_count: u64
The current number of messages that have been sent out (which are
also defined as message ids) via this Channel
Implementations§
Source§impl Channel
Channel methods for basic functionality
impl Channel
Channel methods for basic functionality
Sourcepub fn new(ship_interface: ShipInterface) -> Result<Channel>
pub fn new(ship_interface: ShipInterface) -> Result<Channel>
Create a new channel
Sourcepub fn poke(
&mut self,
app: &str,
mark: &str,
json: &JsonValue,
) -> Result<Response>
pub fn poke( &mut self, app: &str, mark: &str, json: &JsonValue, ) -> Result<Response>
Sends a poke over the channel
Sourcepub fn scry(&self, app: &str, path: &str, mark: &str) -> Result<Response>
pub fn scry(&self, app: &str, path: &str, mark: &str) -> Result<Response>
Sends a scry to the ship
Sourcepub fn spider(
&self,
input_mark: &str,
output_mark: &str,
thread_name: &str,
body: &JsonValue,
) -> Result<Response>
pub fn spider( &self, input_mark: &str, output_mark: &str, thread_name: &str, body: &JsonValue, ) -> Result<Response>
Run a thread via spider
Sourcepub fn create_new_subscription(
&mut self,
app: &str,
path: &str,
) -> Result<CreationID>
pub fn create_new_subscription( &mut self, app: &str, path: &str, ) -> Result<CreationID>
Create a new Subscription
and thus subscribes to events on the
ship with the provided app/path.
Sourcepub fn parse_event_messages(&mut self)
pub fn parse_event_messages(&mut self)
Parses SSE messages for this channel and moves them into
the proper corresponding Subscription
’s message_list
.
Sourcepub fn find_subscription(
&mut self,
app: &str,
path: &str,
) -> Option<&mut Subscription>
pub fn find_subscription( &mut self, app: &str, path: &str, ) -> Option<&mut Subscription>
Finds the first Subscription
in the list which has a matching
app
and path
;
Sourcepub fn unsubscribe(&mut self, app: &str, path: &str) -> Option<bool>
pub fn unsubscribe(&mut self, app: &str, path: &str) -> Option<bool>
Finds the first Subscription
in the list which has a matching
app
and path
, removes it from the list, and tells the ship
that you are unsubscribing. Returns None
if failed to find
a subscription with a matching app & path.
Sourcepub fn delete_channel(self)
pub fn delete_channel(self)
Deletes the channel
Source§impl Channel
Channel
methods which expose advanced functionality, typically by
producing another struct which is built on top of Channel
.
impl Channel
Channel
methods which expose advanced functionality, typically by
producing another struct which is built on top of Channel
.
Sourcepub fn chat(&mut self) -> Chat<'_>
pub fn chat(&mut self) -> Chat<'_>
Create a Chat
struct which exposes an interface for interacting
with chats on Urbit
Sourcepub fn notebook(&mut self) -> Notebook<'_>
pub fn notebook(&mut self) -> Notebook<'_>
Create a Notebook
struct which exposes an interface for interacting
with notebooks on Urbit
Sourcepub fn graph_store(&mut self) -> GraphStore<'_>
pub fn graph_store(&mut self) -> GraphStore<'_>
Create a GraphStore
struct which exposes an interface for interacting
with a ship’s Graph Store.
Sourcepub fn collection(&mut self) -> Collection<'_>
pub fn collection(&mut self) -> Collection<'_>
Create a Collection
struct which exposes an interface for interacting
with collections on Urbit.