pub struct Publish { /* private fields */ }
Expand description
The command to tell publishing information.
Implementations§
Source§impl Publish
impl Publish
Sourcepub fn new(publishing_name: AmfString, publishing_type: AmfString) -> Self
pub fn new(publishing_name: AmfString, publishing_type: AmfString) -> Self
Constructs a Publish command.
Sourcepub fn get_publishing_name(&self) -> &AmfString
pub fn get_publishing_name(&self) -> &AmfString
Gets the publishing identifier. (e.g. filename, username, etc.)
Sourcepub fn get_publishing_type(&self) -> &AmfString
pub fn get_publishing_type(&self) -> &AmfString
Gets one of publishing type which is either "live"
, "record"
or "append"
.
Trait Implementations§
Source§impl ChunkData for Publish
impl ChunkData for Publish
const CHANNEL: Channel = Channel::Source
const MESSAGE_TYPE: MessageType = MessageType::Command
Source§impl Decoder<Publish> for ByteBuffer
impl Decoder<Publish> for ByteBuffer
Source§fn decode(&mut self) -> IOResult<Publish>
fn decode(&mut self) -> IOResult<Publish>
Decodes bytes into a Publish command.
§Errors
When some field misses.
When some value is inconsistent with its marker.
When some value is invalid for UTF-8 string.
When the publishing type is neither "live"
, "record"
nor "append"
.
§Examples
use sheave_core::{
ByteBuffer,
Decoder,
Encoder,
messages::{
Publish,
amf::v0::{
AmfString,
Null
}
}
};
let mut buffer = ByteBuffer::default();
buffer.encode(&Null);
buffer.encode(&AmfString::default());
buffer.encode(&AmfString::from("live"));
assert!(Decoder::<Publish>::decode(&mut buffer).is_ok());
let mut buffer = ByteBuffer::default();
buffer.encode(&Null);
buffer.encode(&AmfString::default());
buffer.encode(&AmfString::from("record"));
assert!(Decoder::<Publish>::decode(&mut buffer).is_ok());
let mut buffer = ByteBuffer::default();
buffer.encode(&Null);
buffer.encode(&AmfString::default());
buffer.encode(&AmfString::from("append"));
assert!(Decoder::<Publish>::decode(&mut buffer).is_ok());
let mut buffer = ByteBuffer::default();
buffer.encode(&Null);
buffer.encode(&AmfString::default());
buffer.encode(&AmfString::from("something else"));
assert!(Decoder::<Publish>::decode(&mut buffer).is_err())
Source§impl Encoder<Publish> for ByteBuffer
impl Encoder<Publish> for ByteBuffer
impl Command for Publish
impl StructuralPartialEq for Publish
Auto Trait Implementations§
impl Freeze for Publish
impl RefUnwindSafe for Publish
impl Send for Publish
impl Sync for Publish
impl Unpin for Publish
impl UnwindSafe for Publish
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more