Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Mark generated functions as #[inline] (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu authored and m4b committed Apr 28, 2018
1 parent c433e6a commit 81153b1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fn impl_struct(name: &syn::Ident, fields: &syn::FieldsNamed) -> quote::Tokens {
impl<'a> ::scroll::ctx::TryFromCtx<'a, ::scroll::Endian> for #name where #name: 'a {
type Error = ::scroll::Error;
type Size = usize;
#[inline]
fn try_from_ctx(src: &'a [u8], ctx: ::scroll::Endian) -> ::scroll::export::result::Result<(Self, Self::Size), Self::Error> {
use ::scroll::Pread;
let offset = &mut 0;
Expand Down Expand Up @@ -93,6 +94,7 @@ fn impl_try_into_ctx(name: &syn::Ident, fields: &syn::FieldsNamed) -> quote::Tok
impl ::scroll::ctx::TryIntoCtx<::scroll::Endian> for #name {
type Error = ::scroll::Error;
type Size = usize;
#[inline]
fn try_into_ctx(self, dst: &mut [u8], ctx: ::scroll::Endian) -> ::scroll::export::result::Result<Self::Size, Self::Error> {
use ::scroll::Pwrite;
let offset = &mut 0;
Expand Down Expand Up @@ -199,6 +201,7 @@ fn impl_cread_struct(name: &syn::Ident, fields: &syn::FieldsNamed) -> quote::Tok

quote! {
impl ::scroll::ctx::FromCtx<::scroll::Endian> for #name {
#[inline]
fn from_ctx(src: &[u8], ctx: ::scroll::Endian) -> Self {
use ::scroll::Cread;
let offset = &mut 0;
Expand Down Expand Up @@ -260,6 +263,7 @@ fn impl_into_ctx(name: &syn::Ident, fields: &syn::FieldsNamed) -> quote::Tokens

quote! {
impl ::scroll::ctx::IntoCtx<::scroll::Endian> for #name {
#[inline]
fn into_ctx(self, dst: &mut [u8], ctx: ::scroll::Endian) {
use ::scroll::Cwrite;
let offset = &mut 0;
Expand Down

0 comments on commit 81153b1

Please sign in to comment.