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

Need enum to choose big/little #124

Closed
damody opened this issue May 3, 2018 · 1 comment
Closed

Need enum to choose big/little #124

damody opened this issue May 3, 2018 · 1 comment

Comments

@damody
Copy link

damody commented May 3, 2018

like this

enum ByteOrder {
BigEndian,
LittleEndian,
}

then we can use the struct like parameter
like this

pub fn hello(order:ByteOrder) ->() {
    let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
    match order {
    BigEndian => rdr.read_u16::<BigEndian>().unwrap();
    LittleEndian => rdr.read_u16::<LittleEndian>().unwrap();
    _=>()
    }
}
@BurntSushi
Copy link
Owner

This issue is drastically under specified, and I believe it is a duplicate of #95.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants