Giter Site home page Giter Site logo

zerocopy's Introduction

zerocopy

Utilities for safe zero-copy parsing and serialization.

This crate provides utilities which make it easy to perform zero-copy parsing and serialization by allowing zero-copy conversion to/from byte slices.

This is enabled by four core marker traits, each of which can be derived (e.g., #[derive(FromBytes)]):

  • FromZeroes indicates that a sequence of zero bytes represents a valid instance of a type
  • FromBytes indicates that a type may safely be converted from an arbitrary byte sequence
  • AsBytes indicates that a type may safely be converted to a byte sequence
  • Unaligned indicates that a type's alignment requirement is 1

Types which implement a subset of these traits can then be converted to/from byte sequences with little to no runtime overhead.

Note that these traits are ignorant of byte order. For byte order-aware types, see the byteorder module.

Features

alloc: By default, zerocopy is no_std. When the alloc feature is enabled, the alloc crate is added as a dependency, and some allocation-related functionality is added.

simd: When the simd feature is enabled, FromZeroes, FromBytes, and AsBytes impls are emitted for all stable SIMD types which exist on the target platform. Note that the layout of SIMD types is not yet stabilized, so these impls may be removed in the future if layout changes make them invalid. For more information, see the Unsafe Code Guidelines Reference page on the Layout of packed SIMD vectors.

simd-nightly: Enables the simd feature and adds support for SIMD types which are only available on nightly. Since these types are unstable, support for any type may be removed at any point in the future.

Disclaimer

Disclaimer: Zerocopy is not an officially supported Google product.

zerocopy's People

Contributors

akonradi avatar antoniosbarotsis avatar benbrittain avatar birkenfeld avatar brunowonka avatar djkoloski avatar frazar avatar fwalch avatar gburgessiv avatar glokta1 avatar joshlf avatar jswrenn avatar kupiakos avatar marinaciocea-zz avatar mcy avatar memark avatar mnkhouri avatar msalah73 avatar nekorevend avatar nmulcahey avatar rabisg0 avatar ryanrussell avatar sanchithhegde avatar shaybarak avatar sivadeilra avatar tamird avatar varadtote avatar willglynn avatar yotamofek avatar zeroomega avatar

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.