Giter Site home page Giter Site logo

byte-slice-cast's Introduction

byte-slice-cast crates.io Actions Status docs.rs

Safely cast between byte slices and slices of another built-in fundamental number type.

LICENSE

byte-slice-cast is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).

Contribution

Any kinds of contributions are welcome as a pull request.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in byte-slice-cast by you shall be licensed under the MIT license as above, without any additional terms or conditions.

byte-slice-cast's People

Contributors

frostyhitoshura avatar jean-airoldie avatar kijewski avatar koute avatar s1ck avatar sdroege avatar stanislav-tkach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

byte-slice-cast's Issues

What's keeping this from being 1.0 right now?

This API is the exact API that I was imagining when I went to look for a crate like this. More generic even, which is cool.

The version is only at 0.2, but it's been sitting there for half a year it looks like. Is there something holding it back from being 1.0 or could it be version bumped?

Zero length slice casting

The following conversion fails with the AlignmentMismatch error:

let slice: Vec<u8> = Vec::new();
let converted_slice = slice.as_slice_of::<u16>().unwrap();

It is more a question than an issue: can such conversions be made? It will make writing generic code easier.

Cannot compile on wasm32-unknown-emscripten target (debug mode)

I'm trying to compile a project that depends on byte-slice-cast to a wasm32-unknown-emscripten target. However, when building in debug mode, I get the following weird error:

Compiling byte-slice-cast v0.3.5
Referencing function in another module!
  call void <badref>(i8* %22), !dbg !149
; ModuleID = 'byte_slice_cast.v1okijvo-cgu.15'
void (i8*)* <badref>
; ModuleID = '
error: could not compile `byte-slice-cast`.

Building in release mode works just fine. Compiling any project that depends on byte-slice-cast (even a simple hello world project that does nothing but has a dependency on it) to that specific target results in this error. Any ideas on why this is happening?

Tuple support

Would you be willing to pull the patch that adds support for tuples? It looks like the code is good to go and it is only a matter of adding impl_trait!((T, T)) for each type and then testing it.

I wouldn't go deep with the size of tuples and only implement pairs which I think is the most common case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.