coap_request_implementations/
conversions.rs1pub trait AsUriPath {
10 fn as_uri_path(&self) -> impl Iterator<Item = &str>;
11}
12
13impl<'b> AsUriPath for &[&'b str] {
14 fn as_uri_path(&self) -> impl Iterator<Item = &str> {
15 self.iter().map(core::ops::Deref::deref)
16 }
17}
18
19impl AsUriPath for &str {
20 fn as_uri_path(&self) -> impl Iterator<Item = &str> {
21 assert!(self.bytes().next() == Some(b'/'));
22 let slice = self
23 .split('?')
24 .next()
25 .expect("Non-empty strings can be split")
26 .split('#')
27 .next()
28 .expect("Non-emptyh strings can be split");
29 let mut iter = slice.split('/');
30 let _empty = iter.next();
31 iter
32 }
33}