mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
xous-rs: Implement From instead of Into
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
This commit is contained in:
parent
59e3378d11
commit
c74d54f345
3 changed files with 21 additions and 21 deletions
|
|
@ -53,13 +53,13 @@ impl ProcessArgs {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<[usize; 7]> for &ProcessInit {
|
||||
fn into(self) -> [usize; 7] {
|
||||
impl From<&ProcessInit> for [usize; 7] {
|
||||
fn from(init: &ProcessInit) -> [usize; 7] {
|
||||
[
|
||||
u32::from_le_bytes(self.key.0[0..4].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(self.key.0[4..8].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(self.key.0[8..12].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(self.key.0[12..16].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(init.key.0[0..4].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(init.key.0[4..8].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(init.key.0[8..12].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(init.key.0[12..16].try_into().unwrap()) as _,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
|
@ -120,9 +120,9 @@ impl From<[usize; 8]> for ProcessStartup {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<[usize; 7]> for &ProcessStartup {
|
||||
fn into(self) -> [usize; 7] {
|
||||
[self.pid.get() as _, 0, 0, 0, 0, 0, 0]
|
||||
impl From<&ProcessStartup> for [usize; 7] {
|
||||
fn from(startup: &ProcessStartup) -> [usize; 7] {
|
||||
[startup.pid.get() as _, 0, 0, 0, 0, 0, 0]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ pub struct ProcessInit {
|
|||
// 6
|
||||
}
|
||||
|
||||
impl Into<[usize; 7]> for &ProcessInit {
|
||||
impl From<&ProcessInit> for [usize; 7] {
|
||||
fn into(self) -> [usize; 7] {
|
||||
[
|
||||
self.stack.addr.get(),
|
||||
|
|
@ -121,7 +121,7 @@ impl From<[usize; 8]> for ProcessStartup {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<[usize; 7]> for &ProcessStartup {
|
||||
impl From<&ProcessStartup> for [usize; 7] {
|
||||
fn into(self) -> [usize; 7] {
|
||||
[self.pid.get() as _, self.connection as _, 0, 0, 0, 0, 0]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ impl ProcessKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<String> for ProcessKey {
|
||||
fn into(self) -> String {
|
||||
let mut out = String::new();
|
||||
impl core::fmt::Display for ProcessKey {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
for i in self.0 {
|
||||
out.push_str(&format!("{:02x}", i));
|
||||
write!(f, "{:02x}", i)?;
|
||||
}
|
||||
out
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -184,14 +184,14 @@ impl From<[usize; 8]> for ProcessStartup {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<[usize; 7]> for &ProcessStartup {
|
||||
fn into(self) -> [usize; 7] {
|
||||
[self.pid.get() as _, 0, 0, 0, 0, 0, 0]
|
||||
impl From<&ProcessStartup> for [usize; 7] {
|
||||
fn from(startup: &ProcessStartup) -> [usize; 7] {
|
||||
[startup.pid.get() as _, 0, 0, 0, 0, 0, 0]
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<[usize; 7]> for &ProcessInit {
|
||||
fn into(self) -> [usize; 7] {
|
||||
impl From<&ProcessInit> for [usize; 7] {
|
||||
fn from(init: &ProcessInit) -> [usize; 7] {
|
||||
[
|
||||
u32::from_le_bytes(self.key.0[0..4].try_into().unwrap()) as _,
|
||||
u32::from_le_bytes(self.key.0[4..8].try_into().unwrap()) as _,
|
||||
|
|
|
|||
Loading…
Reference in a new issue