Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
Tenjin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
Tenjin
Commits
fe0a1f48
Commit
fe0a1f48
authored
Jul 13, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
impl from to msg
parent
950409b2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
message.rs
src/openflow/ofp13/message.rs
+8
-1
No files found.
src/openflow/ofp13/message.rs
View file @
fe0a1f48
use
std
::
mem
::
transmute
;
use
std
::
mem
::
transmute
;
#[repr(u8)]
#[derive(Clone)]
#[derive(Clone)]
pub
enum
Msg
{
pub
enum
Msg
{
Hello
=
0
,
Hello
=
0
,
...
@@ -37,7 +38,7 @@ pub enum Msg {
...
@@ -37,7 +38,7 @@ pub enum Msg {
impl
Msg
{
impl
Msg
{
pub
fn
to_int
(
&
self
)
->
u8
{
pub
fn
to_int
(
&
self
)
->
u8
{
self
.clone
()
as
u8
self
.clone
()
.into
()
}
}
pub
fn
from
(
msg_code
:
u8
)
->
Self
{
pub
fn
from
(
msg_code
:
u8
)
->
Self
{
if
msg_code
>
21
{
if
msg_code
>
21
{
...
@@ -46,3 +47,9 @@ impl Msg {
...
@@ -46,3 +47,9 @@ impl Msg {
unsafe
{
transmute
::
<
u8
,
Msg
>
(
msg_code
)
}
unsafe
{
transmute
::
<
u8
,
Msg
>
(
msg_code
)
}
}
}
}
}
impl
From
<
Msg
>
for
u8
{
fn
from
(
value
:
Msg
)
->
Self
{
value
as
u8
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment