diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2020-12-21 16:12:20 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-12-21 16:12:20 +0000 |
commit | 91816080a78197ee5e99a8e482211976263024c7 (patch) | |
tree | 04fae80122d9b77f9f591a3dadfa926525334bf8 | |
parent | b4fe4408cdb8e2869688f304d78157cea6f07fa3 (diff) | |
parent | 89c35f0dd06b363a250f98d4e83e391153a0aa96 (diff) | |
download | tinyvec_macros-91816080a78197ee5e99a8e482211976263024c7.tar.gz |
Initial commit of tinyvec_macros v0.1.0 am: e27fd4bfe9 am: 89c35f0dd0
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/tinyvec_macros/+/1533443
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Id4cdbba6230f1c1d48b6ea697c5f99497ebf2120
-rw-r--r-- | .cargo_vcs_info.json | 5 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Cargo.toml | 22 | ||||
-rw-r--r-- | Cargo.toml.orig | 12 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | METADATA | 19 | ||||
-rw-r--r-- | MODULE_LICENSE_APACHE2 | 0 | ||||
-rw-r--r-- | OWNERS | 1 | ||||
-rw-r--r-- | src/lib.rs | 24 |
9 files changed, 106 insertions, 0 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json new file mode 100644 index 0000000..c4fc324 --- /dev/null +++ b/.cargo_vcs_info.json @@ -0,0 +1,5 @@ +{ + "git": { + "sha1": "24f1c4e9c8b878c904c1673b0becb912f7d55518" + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..02baede --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,22 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + +[package] +edition = "2018" +name = "tinyvec_macros" +version = "0.1.0" +authors = ["Soveu <marx.tomasz@gmail.com>"] +description = "Some macros for tiny containers" +license = "MIT OR Apache-2.0 OR Zlib" +repository = "https://github.com/Soveu/tinyvec_macros" + +[dependencies] diff --git a/Cargo.toml.orig b/Cargo.toml.orig new file mode 100644 index 0000000..8d6e0a8 --- /dev/null +++ b/Cargo.toml.orig @@ -0,0 +1,12 @@ +[package] +name = "tinyvec_macros" +version = "0.1.0" +authors = ["Soveu <marx.tomasz@gmail.com>"] +edition = "2018" +license = "MIT OR Apache-2.0 OR Zlib" +repository = "https://github.com/Soveu/tinyvec_macros" +description = "Some macros for tiny containers" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Soveu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/METADATA b/METADATA new file mode 100644 index 0000000..91f18d3 --- /dev/null +++ b/METADATA @@ -0,0 +1,19 @@ +name: "tinyvec_macros" +description: "Some macros for tiny containers" +third_party { + url { + type: HOMEPAGE + value: "https://crates.io/crates/tinyvec_macros" + } + url { + type: ARCHIVE + value: "https://static.crates.io/crates/tinyvec_macros/tinyvec_macros-0.1.0.crate" + } + version: "0.1.0" + license_type: NOTICE + last_upgrade_date { + year: 2020 + month: 12 + day: 15 + } +} diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/MODULE_LICENSE_APACHE2 @@ -0,0 +1 @@ +include platform/prebuilts/rust:/OWNERS diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..4790e08 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,24 @@ +#![no_std] + +#[macro_export] +macro_rules! impl_mirrored { + { + type Mirror = $tinyname:ident; + $( + $(#[$attr:meta])* + $v:vis fn $fname:ident ($seif:ident : $seifty:ty $(,$argname:ident : $argtype:ty)*) $(-> $ret:ty)? ; + )* + } => { + $( + $(#[$attr])* + #[inline(always)] + $v fn $fname($seif : $seifty, $($argname: $argtype),*) $(-> $ret)? { + match $seif { + $tinyname::Inline(i) => i.$fname($($argname),*), + $tinyname::Heap(h) => h.$fname($($argname),*), + } + } + )* + }; +} + |