Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Section trait to use Reader #217

Merged
merged 2 commits into from
Jul 10, 2017
Merged

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Jul 9, 2017

I tried to keep the From<&[u8]>, but couldn't get it to work, eg something like:

// error[E0207]: the type parameter `Endian` is not constrained by the impl trait, self type, or predicates
impl<'input, Endian, T> From<&'input [u8]> for T
    where T: Section<EndianBuf<'input, Endian>>,
          Endian: Endianity
{
    fn from(v: &'input [u8]) -> Self {
        Self::from(EndianBuf::new(v))
    }
}

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.393% when pulling ab3d9e0 on philipc:section into fdd6feb on gimli-rs:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.393% when pulling de2f1bd on philipc:section into fdd6feb on gimli-rs:master.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

S::from(gimli::EndianBuf::new(data))
}

let debug_abbrev: &gimli::DebugAbbrev<_> = &load_section::<_, Endian>(file);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this one need a turbo fish but the others don't?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Endian needs to be specified at least once, because it can't be inferred. But specifying it once is enough to let the rest be inferred.

@fitzgen fitzgen merged commit 4427fb1 into gimli-rs:master Jul 10, 2017
@philipc philipc deleted the section branch July 10, 2017 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants