Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
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
submodule
flatbuffers
Commits
db972be2
Commit
db972be2
authored
Jul 09, 2019
by
jean-airoldie
Committed by
Robert Winslow
Jul 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rust] Ran rustfmt against library code (#5389)
parent
e304f8c1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
20 deletions
+14
-20
builder.rs
rust/flatbuffers/src/builder.rs
+0
-0
endian_scalar.rs
rust/flatbuffers/src/endian_scalar.rs
+4
-5
lib.rs
rust/flatbuffers/src/lib.rs
+5
-3
primitives.rs
rust/flatbuffers/src/primitives.rs
+2
-2
push.rs
rust/flatbuffers/src/push.rs
+2
-3
vector.rs
rust/flatbuffers/src/vector.rs
+0
-1
vtable.rs
rust/flatbuffers/src/vtable.rs
+1
-5
vtable_writer.rs
rust/flatbuffers/src/vtable_writer.rs
+0
-1
No files found.
rust/flatbuffers/src/builder.rs
View file @
db972be2
This diff is collapsed.
Click to expand it.
rust/flatbuffers/src/endian_scalar.rs
View file @
db972be2
...
...
@@ -34,7 +34,7 @@ pub trait EndianScalar: Sized + PartialEq + Copy + Clone {
/// Macro for implementing a no-op endian conversion. This is used for types
/// that are one byte wide.
macro_rules!
impl_endian_scalar_noop
{
(
$ty:ident
)
=>
(
(
$ty:ident
)
=>
{
impl
EndianScalar
for
$ty
{
#[inline]
fn
to_little_endian
(
self
)
->
Self
{
...
...
@@ -45,7 +45,7 @@ macro_rules! impl_endian_scalar_noop {
self
}
}
)
};
}
/// Macro for implementing an endian conversion using the stdlib `to_le` and
...
...
@@ -53,7 +53,7 @@ macro_rules! impl_endian_scalar_noop {
/// floats, because the `to_le` and `from_le` are not implemented for them in
/// the stdlib.
macro_rules!
impl_endian_scalar_stdlib_le_conversion
{
(
$ty:ident
)
=>
(
(
$ty:ident
)
=>
{
impl
EndianScalar
for
$ty
{
#[inline]
fn
to_little_endian
(
self
)
->
Self
{
...
...
@@ -64,7 +64,7 @@ macro_rules! impl_endian_scalar_stdlib_le_conversion {
Self
::
from_le
(
self
)
}
}
)
};
}
impl_endian_scalar_noop!
(
bool
);
...
...
@@ -177,4 +177,3 @@ pub fn read_scalar<T: EndianScalar>(s: &[u8]) -> T {
x
.from_little_endian
()
}
rust/flatbuffers/src/lib.rs
View file @
db972be2
...
...
@@ -39,12 +39,14 @@ mod vtable;
mod
vtable_writer
;
pub
use
builder
::
FlatBufferBuilder
;
pub
use
endian_scalar
::{
EndianScalar
,
emplace_scalar
,
read_scalar
,
read_scalar_at
,
byte_swap_f32
,
byte_swap_f64
};
pub
use
endian_scalar
::{
byte_swap_f32
,
byte_swap_f64
,
emplace_scalar
,
read_scalar
,
read_scalar_at
,
EndianScalar
,
};
pub
use
follow
::{
Follow
,
FollowStart
};
pub
use
primitives
::
*
;
pub
use
push
::
Push
;
pub
use
table
::{
Table
,
buffer_has_identifier
,
get_root
,
get_size_prefixed_root
};
pub
use
vector
::{
SafeSliceAccess
,
Vector
,
follow_cast_ref
};
pub
use
table
::{
buffer_has_identifier
,
get_root
,
get_size_prefixed_root
,
Table
};
pub
use
vector
::{
follow_cast_ref
,
SafeSliceAccess
,
Vector
};
pub
use
vtable
::
field_index_to_field_offset
;
// TODO(rw): Unify `create_vector` and `create_vector_direct` by using
...
...
rust/flatbuffers/src/primitives.rs
View file @
db972be2
...
...
@@ -274,7 +274,7 @@ impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipFileIdentifier<T> {
/// EndianScalar, but implementing Follow that way causes a conflict with
/// other impls.
macro_rules!
impl_follow_for_endian_scalar
{
(
$ty:ident
)
=>
(
(
$ty:ident
)
=>
{
impl
<
'a
>
Follow
<
'a
>
for
$ty
{
type
Inner
=
$ty
;
#[inline(always)]
...
...
@@ -282,7 +282,7 @@ macro_rules! impl_follow_for_endian_scalar {
read_scalar_at
::
<
$ty
>
(
buf
,
loc
)
}
}
)
};
}
impl_follow_for_endian_scalar!
(
bool
);
...
...
rust/flatbuffers/src/push.rs
View file @
db972be2
...
...
@@ -55,7 +55,7 @@ impl PushAlignment {
/// Macro to implement Push for EndianScalar types.
macro_rules!
impl_push_for_endian_scalar
{
(
$ty:ident
)
=>
(
(
$ty:ident
)
=>
{
impl
Push
for
$ty
{
type
Output
=
$ty
;
...
...
@@ -63,9 +63,8 @@ macro_rules! impl_push_for_endian_scalar {
fn
push
(
&
self
,
dst
:
&
mut
[
u8
],
_rest
:
&
[
u8
])
{
emplace_scalar
::
<
$ty
>
(
dst
,
*
self
);
}
}
)
};
}
impl_push_for_endian_scalar!
(
bool
);
...
...
rust/flatbuffers/src/vector.rs
View file @
db972be2
...
...
@@ -134,4 +134,3 @@ impl<'a, T: Follow<'a> + 'a> Follow<'a> for Vector<'a, T> {
Vector
::
new
(
buf
,
loc
)
}
}
rust/flatbuffers/src/vtable.rs
View file @
db972be2
...
...
@@ -34,10 +34,7 @@ impl<'a> PartialEq for VTable<'a> {
impl
<
'a
>
VTable
<
'a
>
{
pub
fn
init
(
buf
:
&
'a
[
u8
],
loc
:
usize
)
->
Self
{
VTable
{
buf
:
buf
,
loc
:
loc
,
}
VTable
{
buf
:
buf
,
loc
:
loc
}
}
pub
fn
num_fields
(
&
self
)
->
usize
{
(
self
.num_bytes
()
/
SIZE_VOFFSET
)
-
2
...
...
@@ -72,7 +69,6 @@ impl<'a> VTable<'a> {
}
}
#[allow(dead_code)]
pub
fn
field_index_to_field_offset
(
field_id
:
VOffsetT
)
->
VOffsetT
{
// Should correspond to what end_table() below builds up.
...
...
rust/flatbuffers/src/vtable_writer.rs
View file @
db972be2
...
...
@@ -82,4 +82,3 @@ impl<'a> VTableWriter<'a> {
}
}
}
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