pub enum FieldMap {
UPnP(String),
UUID(String),
URN(String),
Unknown(String, String),
}Expand description
Enumerates key value pairs embedded within SSDP header fields.
Variants§
UPnP(String)
The “upnp” key with its associated value.
UUID(String)
The “uuid” key with its associated value.
URN(String)
The “urn” key with its associated value.
Unknown(String, String)
An undefined key, the key and it’s value are returned.
Implementations§
Source§impl FieldMap
impl FieldMap
Sourcepub fn new<'a, S: Into<Cow<'a, str>>>(value: S) -> Option<Self>
pub fn new<'a, S: Into<Cow<'a, str>>>(value: S) -> Option<Self>
Breaks a field up into a single key and single value which are separated by a colon and neither of which are empty.
Separation will occur at the first colon encountered.
Sourcepub fn parse_bytes(field: &[u8]) -> Option<Self>
pub fn parse_bytes(field: &[u8]) -> Option<Self>
Breaks a field up into a single key and single value which are separated by a colon and neither of which are empty.
Separation will occur at the first colon encountered.
Sourcepub fn upnp<'a, S: Into<Cow<'a, str>>>(value: S) -> Self
pub fn upnp<'a, S: Into<Cow<'a, str>>>(value: S) -> Self
Examples found in repository?
examples/async_notify.rs (line 26)
11fn main() {
12 thread::spawn(|| {
13 for (msg, src) in NotifyListener::listen().unwrap() {
14 println!("Received The Following Message From {}:\n{:?}\n", src, msg);
15 }
16 });
17
18 // Make Sure Thread Has Started
19 thread::sleep(Duration::new(1, 0));
20
21 // Create A Test Message
22 let mut message = NotifyMessage::new();
23
24 // Set Some Headers
25 message.set(NTS::ByeBye);
26 message.set(NT(FieldMap::upnp("rootdevice")));
27 message.set(USN(FieldMap::uuid("Hello, This Is Not A UUID!!!"), None));
28
29 message.multicast().unwrap();
30
31 // Wait Until User Is Done Listening For Notify Messages
32 println!("Press Enter When You Wish To Exit...\n");
33 let input = io::stdin();
34
35 input.bytes().next();
36}Sourcepub fn uuid<'a, S: Into<Cow<'a, str>>>(value: S) -> Self
pub fn uuid<'a, S: Into<Cow<'a, str>>>(value: S) -> Self
Examples found in repository?
examples/async_notify.rs (line 27)
11fn main() {
12 thread::spawn(|| {
13 for (msg, src) in NotifyListener::listen().unwrap() {
14 println!("Received The Following Message From {}:\n{:?}\n", src, msg);
15 }
16 });
17
18 // Make Sure Thread Has Started
19 thread::sleep(Duration::new(1, 0));
20
21 // Create A Test Message
22 let mut message = NotifyMessage::new();
23
24 // Set Some Headers
25 message.set(NTS::ByeBye);
26 message.set(NT(FieldMap::upnp("rootdevice")));
27 message.set(USN(FieldMap::uuid("Hello, This Is Not A UUID!!!"), None));
28
29 message.multicast().unwrap();
30
31 // Wait Until User Is Done Listening For Notify Messages
32 println!("Press Enter When You Wish To Exit...\n");
33 let input = io::stdin();
34
35 input.bytes().next();
36}pub fn urn<'a, S: Into<Cow<'a, str>>>(value: S) -> Self
pub fn unknown<'a, S: Into<Cow<'a, str>>, S2: Into<Cow<'a, str>>>( key: S, value: S2, ) -> Self
Trait Implementations§
impl Eq for FieldMap
impl StructuralPartialEq for FieldMap
Auto Trait Implementations§
impl Freeze for FieldMap
impl RefUnwindSafe for FieldMap
impl Send for FieldMap
impl Sync for FieldMap
impl Unpin for FieldMap
impl UnwindSafe for FieldMap
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