diff options
author | 2023-07-07 22:58:51 +0000 | |
---|---|---|
committer | 2023-07-13 16:58:06 +0000 | |
commit | 43d9afccaa932fd0d00623e63d13bcc874796b4e (patch) | |
tree | 796fbf0f0b5247fa14f758ae22936311dd7b19eb | |
parent | 29aa368928671bbcd2a34994afe6bf90b464cb87 (diff) |
Add the basic files needed for an empty library.
Test: None
Bug: 290409936
Pair: jshargo
Change-Id: I7a31fcbd3f1facc519e6020d17a9de3f1b2e3d91
-rw-r--r-- | libs/bufferstreams/README.md | 13 | ||||
-rw-r--r-- | libs/bufferstreams/include/bufferstreams.h | 13 | ||||
-rw-r--r-- | libs/bufferstreams/rust/Android.bp | 23 | ||||
-rw-r--r-- | libs/bufferstreams/rust/Cargo.lock | 7 | ||||
-rw-r--r-- | libs/bufferstreams/rust/Cargo.toml | 6 | ||||
-rw-r--r-- | libs/bufferstreams/rust/cbindgen.toml | 149 | ||||
-rw-r--r-- | libs/bufferstreams/rust/src/lib.rs | 22 | ||||
-rwxr-xr-x | libs/bufferstreams/update_include.sh | 2 |
8 files changed, 235 insertions, 0 deletions
diff --git a/libs/bufferstreams/README.md b/libs/bufferstreams/README.md new file mode 100644 index 0000000000..860adef281 --- /dev/null +++ b/libs/bufferstreams/README.md @@ -0,0 +1,13 @@ +# libbufferstreams: Reactive Streams for Graphics Buffers + +This library is currently **experimental** and **under active development**. +It is not production ready yet. + +For more information on reactive streams, please see <https://www.reactive-streams.org/> + +## Contributing + +This library is natively written in Rust and exposes a C API. If you make changes to the Rust API, +you **must** update the C API in turn. To do so, with cbindgen installed, run: + +```$ ./update_include.sh``` diff --git a/libs/bufferstreams/include/bufferstreams.h b/libs/bufferstreams/include/bufferstreams.h new file mode 100644 index 0000000000..5308de24c0 --- /dev/null +++ b/libs/bufferstreams/include/bufferstreams.h @@ -0,0 +1,13 @@ +/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ + +#include <stdarg.h> +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <stdlib.h> + + +/** + * This function will print Hello World. + */ +bool hello(void); diff --git a/libs/bufferstreams/rust/Android.bp b/libs/bufferstreams/rust/Android.bp new file mode 100644 index 0000000000..95a85b550f --- /dev/null +++ b/libs/bufferstreams/rust/Android.bp @@ -0,0 +1,23 @@ +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +rust_library { + name: "libbufferstreams", + crate_name: "bufferstreams", + srcs: ["src/lib.rs"], + edition: "2021", + vendor_available: true, + host_supported: true, + min_sdk_version: "30", +} diff --git a/libs/bufferstreams/rust/Cargo.lock b/libs/bufferstreams/rust/Cargo.lock new file mode 100644 index 0000000000..4482dba6cd --- /dev/null +++ b/libs/bufferstreams/rust/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bufferstreams" +version = "0.1.0" diff --git a/libs/bufferstreams/rust/Cargo.toml b/libs/bufferstreams/rust/Cargo.toml new file mode 100644 index 0000000000..d30c55c551 --- /dev/null +++ b/libs/bufferstreams/rust/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "bufferstreams" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/libs/bufferstreams/rust/cbindgen.toml b/libs/bufferstreams/rust/cbindgen.toml new file mode 100644 index 0000000000..eda837f360 --- /dev/null +++ b/libs/bufferstreams/rust/cbindgen.toml @@ -0,0 +1,149 @@ +# See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml +# for detailed documentation of every option here. + + + +language = "C" + + + +############## Options for Wrapping the Contents of the Header ################# + +# header = "/* Text to put at the beginning of the generated file. Probably a license. */" +# trailer = "/* Text to put at the end of the generated file */" +# include_guard = "my_bindings_h" +# pragma_once = true +autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" +include_version = false +# namespace = "my_namespace" +namespaces = [] +using_namespaces = [] +sys_includes = [] +includes = [] +no_includes = false +after_includes = "" + + + + +############################ Code Style Options ################################ + +braces = "SameLine" +line_length = 100 +tab_width = 2 +documentation = true +documentation_style = "auto" +documentation_length = "full" +line_endings = "LF" # also "CR", "CRLF", "Native" + + + + +############################# Codegen Options ################################## + +style = "both" +sort_by = "Name" # default for `fn.sort_by` and `const.sort_by` +usize_is_size_t = true + + + +[defines] +# "target_os = freebsd" = "DEFINE_FREEBSD" +# "feature = serde" = "DEFINE_SERDE" + + + +[export] +include = [] +exclude = [] +# prefix = "CAPI_" +item_types = [] +renaming_overrides_prefixing = false + + + +[export.rename] + + + +[export.body] + + +[export.mangle] + + +[fn] +rename_args = "None" +# must_use = "MUST_USE_FUNC" +# no_return = "NO_RETURN" +# prefix = "START_FUNC" +# postfix = "END_FUNC" +args = "auto" +sort_by = "Name" + + + + +[struct] +rename_fields = "None" +# must_use = "MUST_USE_STRUCT" +derive_constructor = false +derive_eq = false +derive_neq = false +derive_lt = false +derive_lte = false +derive_gt = false +derive_gte = false + + + + +[enum] +rename_variants = "None" +# must_use = "MUST_USE_ENUM" +add_sentinel = false +prefix_with_name = false +derive_helper_methods = false +derive_const_casts = false +derive_mut_casts = false +# cast_assert_name = "ASSERT" +derive_tagged_enum_destructor = false +derive_tagged_enum_copy_constructor = false +enum_class = true +private_default_tagged_enum_constructor = false + + + + +[const] +allow_static_const = true +allow_constexpr = false +sort_by = "Name" + + + + +[macro_expansion] +bitflags = false + + + + + + +############## Options for How Your Rust library Should Be Parsed ############## + +[parse] +parse_deps = false +# include = [] +exclude = [] +clean = false +extra_bindings = [] + + + +[parse.expand] +crates = [] +all_features = false +default_features = true +features = []
\ No newline at end of file diff --git a/libs/bufferstreams/rust/src/lib.rs b/libs/bufferstreams/rust/src/lib.rs new file mode 100644 index 0000000000..51f1c73c49 --- /dev/null +++ b/libs/bufferstreams/rust/src/lib.rs @@ -0,0 +1,22 @@ +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! libbufferstreams: Reactive Streams for Graphics Buffers + +/// This function will print Hello World. +#[no_mangle] +pub extern "C" fn hello() -> bool { + println!("Hello world."); + true +} diff --git a/libs/bufferstreams/update_include.sh b/libs/bufferstreams/update_include.sh new file mode 100755 index 0000000000..e986e9fb08 --- /dev/null +++ b/libs/bufferstreams/update_include.sh @@ -0,0 +1,2 @@ +cd rust +cbindgen --config cbindgen.toml --crate bufferstreams --output ../include/bufferstreams.h |