Skip to content

Commit

Permalink
fix issue, updating to be compatible with: rust-lang/rust#85482
Browse files Browse the repository at this point in the history
Signed-off-by: gabrik <[email protected]>
  • Loading branch information
gabrik committed May 26, 2021
1 parent 49fe340 commit 9a1acee
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
3 changes: 2 additions & 1 deletion znrpc-macros/examples/expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ where
{
let zinfo = _self.z.info().await;
let pid = zinfo
.get(&zenoh::net::info::ZN_INFO_PID_KEY)?
.get(&zenoh::net::info::ZN_INFO_PID_KEY)
.ok_or(ZRPCError::MissingValue)?
.to_uppercase();
let rid = match zinfo.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY) {
Some(r_info) => {
Expand Down
2 changes: 1 addition & 1 deletion znrpc-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ impl<'a> ZNServiceGenerator<'a> {
S: #service_ident + Send + 'static,
{
let zinfo = _self.z.info().await;
let pid = zinfo.get(&zenoh::net::info::ZN_INFO_PID_KEY)?.to_uppercase();
let pid = zinfo.get(&zenoh::net::info::ZN_INFO_PID_KEY).ok_or(ZRPCError::MissingValue)?.to_uppercase();
let rid = match zinfo.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY) {
Some(r_info) => {
if r_info != "" {
Expand Down
9 changes: 6 additions & 3 deletions zrpc-macros/examples/zworking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ where
let zsession = _self.z.session();
let zinfo = zsession.info().await;
let pid = zinfo
.get(&zenoh::net::info::ZN_INFO_PID_KEY)?
.get(&zenoh::net::info::ZN_INFO_PID_KEY)
.ok_or(ZRPCError::MissingValue)?
.to_uppercase();
let rid = zinfo
.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY)?
.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY)
.ok_or(ZRPCError::MissingValue)?
.split(',')
.collect::<Vec<_>>()[0]
.to_uppercase();
Expand Down Expand Up @@ -563,7 +565,8 @@ impl HelloClient {
let zsession = z.session();
let zinfo = zsession.info().await;
let rid = zinfo
.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY)?
.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY)
.ok_or(ZRPCError::MissingValue)?
.split(',')
.collect::<Vec<_>>()[0]
.to_uppercase();
Expand Down
6 changes: 3 additions & 3 deletions zrpc-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ impl<'a> ZServiceGenerator<'a> {

let zsession = _self.z.session();
let zinfo = zsession.info().await;
let pid = zinfo.get(&zenoh::net::info::ZN_INFO_PID_KEY)?.to_uppercase();
let rid = zinfo.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY)?.split(",").collect::<Vec<_>>()[0].to_uppercase();
let pid = zinfo.get(&zenoh::net::info::ZN_INFO_PID_KEY).ok_or(ZRPCError::MissingValue)?.to_uppercase();
let rid = zinfo.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY).ok_or(ZRPCError::MissingValue)?.split(",").collect::<Vec<_>>()[0].to_uppercase();
let ws = _self.z.workspace(None).await?;


Expand Down Expand Up @@ -1159,7 +1159,7 @@ impl<'a> ZServiceGenerator<'a> {
let ws = z.workspace(None).await?;
let zsession = z.session();
let zinfo = zsession.info().await;
let rid = zinfo.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY)?.split(",").collect::<Vec<_>>()[0].to_uppercase();
let rid = zinfo.get(&zenoh::net::info::ZN_INFO_ROUTER_PID_KEY).ok_or(ZRPCError::MissingValue)?.split(",").collect::<Vec<_>>()[0].to_uppercase();

let selector = zenoh::Selector::try_from(format!("{}/*/state",#eval_path))?;
let mut ds = ws.get(&selector).await?;
Expand Down
1 change: 0 additions & 1 deletion zrpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* ADLINK fog05 team, <[email protected]>
*********************************************************************************/
#![feature(associated_type_bounds)]
#![feature(try_trait)]
#![allow(clippy::upper_case_acronyms)]

pub mod zchannel;
Expand Down
6 changes: 1 addition & 5 deletions zrpc/src/zrpcresult.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ impl From<zenoh::ZError> for ZRPCError {
}
}

impl From<std::option::NoneError> for ZRPCError {
fn from(_err: std::option::NoneError) -> Self {
ZRPCError::MissingValue
}
}

impl From<std::io::Error> for ZRPCError {
fn from(err: std::io::Error) -> Self {
ZRPCError::IOError(err.to_string())
Expand Down

0 comments on commit 9a1acee

Please sign in to comment.