alignment refactor
This commit is contained in:
@@ -9,7 +9,7 @@ impl RPCOperationCancelTunnelQ {
|
||||
pub fn decode(
|
||||
reader: &veilid_capnp::operation_cancel_tunnel_q::Reader,
|
||||
) -> Result<RPCOperationCancelTunnelQ, RPCError> {
|
||||
let id = reader.get_id();
|
||||
let id = TunnelId::new(reader.get_id());
|
||||
|
||||
Ok(RPCOperationCancelTunnelQ { id })
|
||||
}
|
||||
@@ -17,7 +17,7 @@ impl RPCOperationCancelTunnelQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_cancel_tunnel_q::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
builder.set_id(self.id);
|
||||
builder.set_id(self.id.as_u64());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -35,7 +35,7 @@ impl RPCOperationCancelTunnelA {
|
||||
) -> Result<RPCOperationCancelTunnelA, RPCError> {
|
||||
match reader.which().map_err(RPCError::protocol)? {
|
||||
veilid_capnp::operation_cancel_tunnel_a::Which::Tunnel(r) => {
|
||||
Ok(RPCOperationCancelTunnelA::Tunnel(r))
|
||||
Ok(RPCOperationCancelTunnelA::Tunnel(TunnelId::new(r)))
|
||||
}
|
||||
veilid_capnp::operation_cancel_tunnel_a::Which::Error(r) => {
|
||||
let tunnel_error = decode_tunnel_error(r.map_err(RPCError::protocol)?);
|
||||
@@ -49,7 +49,7 @@ impl RPCOperationCancelTunnelA {
|
||||
) -> Result<(), RPCError> {
|
||||
match self {
|
||||
RPCOperationCancelTunnelA::Tunnel(p) => {
|
||||
builder.set_tunnel(*p);
|
||||
builder.set_tunnel(p.as_u64());
|
||||
}
|
||||
RPCOperationCancelTunnelA::Error(e) => {
|
||||
builder.set_error(encode_tunnel_error(*e));
|
||||
|
@@ -12,7 +12,7 @@ impl RPCOperationCompleteTunnelQ {
|
||||
pub fn decode(
|
||||
reader: &veilid_capnp::operation_complete_tunnel_q::Reader,
|
||||
) -> Result<RPCOperationCompleteTunnelQ, RPCError> {
|
||||
let id = reader.get_id();
|
||||
let id = TunnelId::new(reader.get_id());
|
||||
let local_mode = match reader.get_local_mode().map_err(RPCError::protocol)? {
|
||||
veilid_capnp::TunnelEndpointMode::Raw => TunnelMode::Raw,
|
||||
veilid_capnp::TunnelEndpointMode::Turn => TunnelMode::Turn,
|
||||
@@ -32,7 +32,7 @@ impl RPCOperationCompleteTunnelQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_complete_tunnel_q::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
builder.set_id(self.id);
|
||||
builder.set_id(self.id.as_u64());
|
||||
builder.set_local_mode(match self.local_mode {
|
||||
TunnelMode::Raw => veilid_capnp::TunnelEndpointMode::Raw,
|
||||
TunnelMode::Turn => veilid_capnp::TunnelEndpointMode::Turn,
|
||||
|
@@ -11,7 +11,7 @@ impl RPCOperationStartTunnelQ {
|
||||
pub fn decode(
|
||||
reader: &veilid_capnp::operation_start_tunnel_q::Reader,
|
||||
) -> Result<RPCOperationStartTunnelQ, RPCError> {
|
||||
let id = reader.get_id();
|
||||
let id = TunnelId::new(reader.get_id());
|
||||
let local_mode = match reader.get_local_mode().map_err(RPCError::protocol)? {
|
||||
veilid_capnp::TunnelEndpointMode::Raw => TunnelMode::Raw,
|
||||
veilid_capnp::TunnelEndpointMode::Turn => TunnelMode::Turn,
|
||||
@@ -28,7 +28,7 @@ impl RPCOperationStartTunnelQ {
|
||||
&self,
|
||||
builder: &mut veilid_capnp::operation_start_tunnel_q::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
builder.set_id(self.id);
|
||||
builder.set_id(self.id.as_u64());
|
||||
builder.set_local_mode(match self.local_mode {
|
||||
TunnelMode::Raw => veilid_capnp::TunnelEndpointMode::Raw,
|
||||
TunnelMode::Turn => veilid_capnp::TunnelEndpointMode::Turn,
|
||||
|
@@ -58,8 +58,8 @@ pub fn encode_full_tunnel(
|
||||
full_tunnel: &FullTunnel,
|
||||
builder: &mut veilid_capnp::full_tunnel::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
builder.set_id(full_tunnel.id);
|
||||
builder.set_timeout(full_tunnel.timeout);
|
||||
builder.set_id(full_tunnel.id.as_u64());
|
||||
builder.set_timeout(full_tunnel.timeout.as_u64());
|
||||
let mut l_builder = builder.reborrow().init_local();
|
||||
encode_tunnel_endpoint(&full_tunnel.local, &mut l_builder)?;
|
||||
let mut r_builder = builder.reborrow().init_remote();
|
||||
@@ -70,8 +70,8 @@ pub fn encode_full_tunnel(
|
||||
pub fn decode_full_tunnel(
|
||||
reader: &veilid_capnp::full_tunnel::Reader,
|
||||
) -> Result<FullTunnel, RPCError> {
|
||||
let id = reader.get_id();
|
||||
let timeout = reader.get_timeout();
|
||||
let id = TunnelId::new(reader.get_id());
|
||||
let timeout = TimestampDuration::new(reader.get_timeout());
|
||||
let l_reader = reader.get_local().map_err(RPCError::protocol)?;
|
||||
let local = decode_tunnel_endpoint(&l_reader)?;
|
||||
let r_reader = reader.get_remote().map_err(RPCError::protocol)?;
|
||||
@@ -89,8 +89,8 @@ pub fn encode_partial_tunnel(
|
||||
partial_tunnel: &PartialTunnel,
|
||||
builder: &mut veilid_capnp::partial_tunnel::Builder,
|
||||
) -> Result<(), RPCError> {
|
||||
builder.set_id(partial_tunnel.id);
|
||||
builder.set_timeout(partial_tunnel.timeout);
|
||||
builder.set_id(partial_tunnel.id.as_u64());
|
||||
builder.set_timeout(partial_tunnel.timeout.as_u64());
|
||||
let mut l_builder = builder.reborrow().init_local();
|
||||
encode_tunnel_endpoint(&partial_tunnel.local, &mut l_builder)?;
|
||||
Ok(())
|
||||
@@ -99,8 +99,8 @@ pub fn encode_partial_tunnel(
|
||||
pub fn decode_partial_tunnel(
|
||||
reader: &veilid_capnp::partial_tunnel::Reader,
|
||||
) -> Result<PartialTunnel, RPCError> {
|
||||
let id = reader.get_id();
|
||||
let timeout = reader.get_timeout();
|
||||
let id = TunnelId::new(reader.get_id());
|
||||
let timeout = TimestampDuration::new(reader.get_timeout());
|
||||
let l_reader = reader.get_local().map_err(RPCError::protocol)?;
|
||||
let local = decode_tunnel_endpoint(&l_reader)?;
|
||||
|
||||
|
Reference in New Issue
Block a user