Home
last modified time | relevance | path

Searched +full:is +full:- +full:generator +full:- +full:fn (Results 1 – 25 of 1032) sorted by relevance

12345678910>>...42

/aosp_15_r20/external/pigweed/pw_format/rust/pw_format/
H A Dmacros.rs7 // https://www.apache.org/licenses/LICENSE-2.0
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 //! that take format strings and arguments. This is accomplish with three
31 //! An example of implementing a proc macro is provided in the
62 /// [`FormatMacroGenerator`], the error is simply represent by a
71 pub fn new(text: &str) -> Self { in new()
95 fn printf_format_trait(&self) -> Result<Ident> { in printf_format_trait()
101 "formatting untyped conversions with {:?} style is unsupported", in printf_format_trait()
107 fn field_params(&self) -> String { in field_params()
119 fn core_fmt_specifier(&self) -> Result<String> { in core_fmt_specifier()
[all …]
/aosp_15_r20/external/rust/android-crates-io/crates/fastrand/src/
Dlib.rs1 //! A simple and fast random number generator.
3 //! The implementation uses [Wyrand](https://github.com/wangyi-fudan/wyhash), a simple and fast
4 //! generator but **not** cryptographically secure.
32 //! Sample values from an array with `O(n)` complexity (`n` is the length of array):
56 //! To get reproducible results on every run, initialize the generator with a seed:
66 //! To be more efficient, create a new [`Rng`] instance instead of using the thread-local
67 //! generator:
77 //! consider using the [`fastrand-contrib`] crate alongside this one.
81 //! - `std` (enabled by default): Enables the `std` library. This is required for the global
82 //! generator and global entropy. Without this feature, [`Rng`] can only be instantiated using
[all …]
Dglobal_rng.rs1 //! A global, thread-local random number generator.
13 /// Initialize the `Rng` from the system's random number generator.
15 /// This is equivalent to [`Rng::new()`].
17 fn default() -> Rng { in default()
23 /// Creates a new random number generator.
25 pub fn new() -> Rng { in new()
34 /// Run an operation with the current thread-local generator.
36 fn with_rng<R>(f: impl FnOnce(&mut Rng) -> R) -> R { in with_rng()
46 /// Try to run an operation with the current thread-local generator.
48 fn try_with_rng<R>(f: impl FnOnce(&mut Rng) -> R) -> Result<R, std::thread::AccessError> { in try_with_rng()
[all …]
/aosp_15_r20/external/pigweed/pw_format/rust/
H A Dpw_format_test_macros.rs7 // https://www.apache.org/licenses/LICENSE-2.0
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
28 // Generator for testing `generate()`.
34 pub fn new() -> Self { in new()
42 fn finalize(self) -> Result<TokenStream2> { in finalize()
56 fn string_fragment(&mut self, string: &str) -> Result<()> { in string_fragment()
64 fn integer_conversion( in integer_conversion()
70 ) -> Result<()> { in integer_conversion()
83 fn string_conversion(&mut self, expression: Arg) -> Result<()> { in string_conversion()
91 fn char_conversion(&mut self, expression: Arg) -> Result<()> { in char_conversion()
[all …]
H A Dpw_format_example_macro.rs7 // https://www.apache.org/licenses/LICENSE-2.0
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
38 fn parse(input: ParseStream) -> syn::parse::Result<Self> { in parse()
53 // Our generator struct needs to track the prefix as well as the code
55 struct Generator { struct
60 impl Generator { argument
61 pub fn new(prefix: Expr) -> Self { in new()
69 // This toy example implements the generator by calling `format!()` at runtime.
70 impl FormatMacroGenerator for Generator { implementation
72 fn finalize(self) -> Result<TokenStream2> { in finalize()
[all …]
/aosp_15_r20/external/pytorch/test/functorch/
H A Dtest_ops.py6 # This source code is licensed under the BSD-style license found in the
69 # - pytree inputs is allowed (but leaves of the pytree have to all
71 # - if an input is not used as part of derivatives, we will return a
72 # zero-filled tensor for the result
78 if grad_outputs is None:
101 if grad_input is None:
127 # - f' takes only positional arguments
128 # - All arguments to f' are floating-point Tensors
129 # - All outputs of f' are floating-point Tensors
149 if output_process_fn_grad is not None:
[all …]
/aosp_15_r20/external/crosvm/common/audio_streams/src/
H A Daudio_streams.rs2 // Use of this source code is governed by a BSD-style license that can be
7 //! When implementing an audio playback system, the `StreamSource` trait is implemented.
12 //! Users playing audio fill the provided buffers with audio. When a `PlaybackBuffer` is dropped,
22 //! # fn main() -> std::result::Result<(), BoxError> {
77 pub fn sample_bytes(self) -> usize { in sample_bytes()
89 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt()
102 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { in from_str()
153 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { in from_str()
168 /// `StreamSourceGenerator` is a trait used to abstract types that create [`StreamSource`].
171 fn generate(&self) -> Result<Box<dyn StreamSource>, BoxError>; in generate()
[all …]
/aosp_15_r20/external/rust/android-crates-io/crates/clap_complete/src/generator/
Dmod.rs13 /// Generator trait which can be used to write generators
14 pub trait Generator { interface
15 /// Returns the file name that is created when this generator is called during compile time.
26 /// use clap_complete::Generator;
30 /// impl Generator for Fish {
31 /// fn file_name(&self, name: &str) -> String {
34 /// # fn generate(&self, cmd: &Command, buf: &mut dyn Write) {}
37 fn file_name(&self, name: &str) -> String; in file_name()
47 /// The following example generator displays the [`clap::Command`]
48 /// as if it is printed using [`std::println`].
[all …]
/aosp_15_r20/external/pigweed/pw_tokenizer/rust/
H A Dpw_tokenizer_macro.rs7 // https://www.apache.org/licenses/LICENSE-2.0
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 // This proc macro crate is a private API for the `pw_tokenizer` crate.
37 // with the specified `domain`. A detailed description of what's happening is
39 fn token_backend(domain: &str, fragments: &[TokenStream2]) -> TokenStream2 { in token_backend()
42 // pw_tokenizer is intended for use with ELF files only. Mach-O files (macOS in token_backend()
44 // short, unused section name is used on macOS. in token_backend()
75 // This is currently manually verified to be correct. in token_backend()
76 // TODO: b/287132907 - Add integration tests for token database. in token_backend()
85 // Safety: `STRING_LEN` is declared as the length of `STRING_BYTES` above. in token_backend()
[all …]
/aosp_15_r20/external/cronet/third_party/rust/chromium_crates_io/vendor/cxxbridge-macro-1.0.120/src/syntax/
H A Dcheck.rs17 generator: Generator, field
20 pub(crate) enum Generator { enum
21 // cxx-build crate, cxxbridge cli, cxx-gen.
24 // cxxbridge-macro. This is relevant in that the macro output is going to
27 // macro API is able to produce), we avoid duplicating them in our own
33 pub(crate) fn typecheck(cx: &mut Errors, apis: &[Api], types: &Types, generator: Generator) { in typecheck() argument
38 generator, in typecheck()
42 fn do_typecheck(cx: &mut Check) { in do_typecheck()
57 Type::Fn(ty) => check_type_fn(cx, ty), in do_typecheck()
77 pub(crate) fn error(&mut self, sp: impl ToTokens, msg: impl Display) { in error()
[all …]
/aosp_15_r20/external/cronet/third_party/rust/chromium_crates_io/vendor/cxxbridge-cmd-1.0.121/src/syntax/
H A Dcheck.rs17 generator: Generator, field
20 pub(crate) enum Generator { enum
21 // cxx-build crate, cxxbridge cli, cxx-gen.
24 // cxxbridge-macro. This is relevant in that the macro output is going to
27 // macro API is able to produce), we avoid duplicating them in our own
33 pub(crate) fn typecheck(cx: &mut Errors, apis: &[Api], types: &Types, generator: Generator) { in typecheck() argument
38 generator, in typecheck()
42 fn do_typecheck(cx: &mut Check) { in do_typecheck()
57 Type::Fn(ty) => check_type_fn(cx, ty), in do_typecheck()
77 pub(crate) fn error(&mut self, sp: impl ToTokens, msg: impl Display) { in error()
[all …]
/aosp_15_r20/external/rust/cxx/syntax/
Dcheck.rs17 generator: Generator, field
20 pub(crate) enum Generator { enum
21 // cxx-build crate, cxxbridge cli, cxx-gen.
24 // cxxbridge-macro. This is relevant in that the macro output is going to
27 // macro API is able to produce), we avoid duplicating them in our own
33 pub(crate) fn typecheck(cx: &mut Errors, apis: &[Api], types: &Types, generator: Generator) { in typecheck() argument
38 generator, in typecheck()
42 fn do_typecheck(cx: &mut Check) { in do_typecheck()
57 Type::Fn(ty) => check_type_fn(cx, ty), in do_typecheck()
77 pub(crate) fn error(&mut self, sp: impl ToTokens, msg: impl Display) { in error()
[all …]
/aosp_15_r20/external/cronet/third_party/rust/chromium_crates_io/vendor/rand_pcg-0.3.1/src/
H A Dpcg128.rs3 // Copyright 2014-2017 Melissa O'Neill and PCG Project contributors
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
13 // This is the default multiplier used by PCG for 128-bit state.
20 /// A PCG random number generator (XSL RR 128/64 (LCG) variant).
22 /// Permuted Congruential Generator with 128-bit state, internal Linear
23 /// Congruential Generator, and 64-bit output via "xorshift low (bits),
26 /// This is a 128-bit LCG with explicitly chosen stream with the PCG-XSL-RR
27 /// output function. This combination is the standard `pcg64`.
[all …]
/aosp_15_r20/external/rust/crates/openssl/src/
Dec.rs5 //! random elliptic curve. This module provides low-level features of the latter.
10 //! the curves are generally referenced by [`EcGroup`]. There are many built-in groups
41 /// Conversion from the binary value of the point on the curve is performed in one of
42 /// compressed, uncompressed, or hybrid conversions. The default is compressed, except
45 /// Further documentation is available in the [X9.62] standard.
67 /// This type acts as a boolean as to whether the `EcGroup` is named or explicit.
75 /// is included to explicitly define the curve used to calculate keys
100 fn drop = ffi::EC_GROUP_free;
105 /// using openssl binary `openssl ecparam -list_curves`. Other operations
131 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
[all …]
Ddh.rs1 //! Diffie-Hellman key agreement.
16 fn drop = ffi::DH_free;
28 /// Serializes the parameters into a PEM-encoded PKCS#3 DHparameter structure.
30 /// The output will have a header of `-----BEGIN DH PARAMETERS-----`.
37 /// Serializes the parameters into a DER-encoded PKCS#3 DHparameter structure.
45 pub fn check_key(&self) -> Result<bool, ErrorStack> { in check_key()
55 pub fn from_params(p: BigNum, g: BigNum, q: BigNum) -> Result<Dh<Params>, ErrorStack> { in from_params()
59 /// Creates a DH instance based upon the given primes and generator params.
61 pub fn from_pqg( in from_pqg()
64 generator: BigNum, in from_pqg()
[all …]
/aosp_15_r20/external/rust/android-crates-io/crates/protobuf/src/
Dplugin.rs1 // This file is generated by rust-protobuf 3.0.0-pre. Do not edit
2 // .proto file is parsed by protoc --rust-out=...
5 // https://github.com/rust-lang/rust-clippy/issues/702
35 /// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
45 fn default() -> &'a Version { in default()
51 pub fn new() -> Version { in new()
57 pub fn major(&self) -> i32 { in major()
61 pub fn clear_major(&mut self) { in clear_major()
65 pub fn has_major(&self) -> bool { in has_major()
69 // Param is passed by value, moved
[all …]
/aosp_15_r20/external/pigweed/pw_log/rust/
H A Dpw_log_backend_println_macro.rs7 // https://www.apache.org/licenses/LICENSE-2.0
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
39 fn parse(input: ParseStream) -> syn::parse::Result<Self> { in parse()
51 // Generator that implements [`pw_format::CoreFmtFormatMacroGenerator`] to take
59 fn new(log_level: &'a Expr) -> Self { in new()
70 fn finalize(self, format_string: String) -> Result<TokenStream2> { in finalize()
82 fn string_fragment(&mut self, _string: &str) -> Result<()> { in string_fragment()
87 fn integer_conversion(&mut self, ty: Ident, expression: Arg) -> Result<Option<String>> { in integer_conversion()
92 fn string_conversion(&mut self, expression: Arg) -> Result<Option<String>> { in string_conversion()
97 fn char_conversion(&mut self, expression: Arg) -> Result<Option<String>> { in char_conversion()
[all …]
H A Dpw_log_backend_printf_macro.rs7 // https://www.apache.org/licenses/LICENSE-2.0
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
39 fn parse(input: ParseStream) -> syn::parse::Result<Self> { in parse()
51 // Generator that implements [`pw_format::PrintfFormatMacroGenerator`] to take
59 fn new(log_level: &'a Expr) -> Self { in new()
70 fn finalize( in finalize()
73 ) -> Result<TokenStream2> { in finalize()
102 fn string_fragment(&mut self, _string: &str) -> Result<()> { in string_fragment()
107 fn integer_conversion(&mut self, ty: Ident, expression: Arg) -> Result<Option<String>> { in integer_conversion()
114 fn string_conversion(&mut self, expression: Arg) -> Result<Option<String>> { in string_conversion()
[all …]
/aosp_15_r20/external/pytorch/torch/utils/
H A D_content_store.py1 # mypy: allow-untyped-defs
5 # portable across devices) that is NOT cryptographically secure. In return,
7 # compared to running SHA-1 in CPU which would a minute or so. The primary
8 # use case is for efficiently snapshotting intermediate tensor data for
11 # straight reimplementation of SHA-1, which would give us much stronger
14 # WARNING: THERE IS NO BC/FC GUARANTEE FOR THIS FORMAT! If you need to format
25 # Note: only storages are content-addressed; tensors are name addressed
53 def decorate_fn(fn): argument
54 @functools.wraps(fn)
56 compiled_fn = torch.compile(fn, **compile_kwargs)
[all …]
/aosp_15_r20/external/rust/android-crates-io/crates/tokio/src/util/rand/
Drt.rs5 /// A deterministic generator for seeds (and other generators).
7 /// Given the same initial seed, the generator will output the same sequence of seeds.
9 /// Since the seed generator will be kept in a runtime handle, we need to wrap `FastRand`
11 /// thread local store, the expectation is that seed generation will not need to happen
15 /// Internal state for the seed generator. We keep it in a Mutex so that we can safely
21 /// Returns a new generator from the provided seed.
22 pub(crate) fn new(seed: RngSeed) -> Self { in new()
29 pub(crate) fn next_seed(&self) -> RngSeed { in next_seed()
33 .expect("RNG seed generator is internally corrupt"); in next_seed()
41 /// Directly creates a generator using the next seed.
[all …]
/aosp_15_r20/external/pytorch/torch/autograd/
H A Dgradcheck.py1 # mypy: allow-untyped-defs
43 return _is_sparse_compressed_tensor(obj) or obj.layout is torch.sparse_coo
52 ) -> Tuple[torch.Tensor, ...]:
53 # Makes zero-filled tensors from inputs. If `numel_output` is not None, for
54 # each tensor in `input_tensors`, returns a new zero-filled tensor with height
56 # a 1-d tensor with size `(t.numel,)`. Each new tensor will be strided and have
67 ) -> Tuple[torch.Tensor, ...]:
68 # Makes zero-filled tensors from outputs. If `dim` is not None, for each tensor
69 # in `output_tensors`, returns a new zero-filled tensor with height of `dim` and
70 # width of `t.numel`. Otherwise, for each tensor, returns a 1-d tensor with size
[all …]
/aosp_15_r20/external/cronet/third_party/rust/chromium_crates_io/vendor/rand_core-0.6.4/src/
H A Dlib.rs2 // Copyright 2017-2018 The Rust Project Developers.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
12 //! This crate is mainly of interest to crates publishing implementations of
14 //! which re-exports the main traits and error types.
16 //! [`RngCore`] is the core trait implemented by algorithmic pseudo-random number
17 //! generators and external random-number sources.
19 //! [`SeedableRng`] is an extension trait for construction from fixed seeds and
22 //! [`Error`] is provided for error-handling. It is safe to use in `no_std`
[all …]
/aosp_15_r20/external/rust/android-crates-io/crates/rand_core/src/
Dlib.rs2 // Copyright 2017-2018 The Rust Project Developers.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
12 //! This crate is mainly of interest to crates publishing implementations of
14 //! which re-exports the main traits and error types.
16 //! [`RngCore`] is the core trait implemented by algorithmic pseudo-random number
17 //! generators and external random-number sources.
19 //! [`SeedableRng`] is an extension trait for construction from fixed seeds and
22 //! [`Error`] is provided for error-handling. It is safe to use in `no_std`
[all …]
/aosp_15_r20/external/clang/lib/CodeGen/
H A DCGBlocks.cpp1 //===--- CGBlocks.cpp - Emit LLVM Code for declarations ---------*- C++ -*-===//
5 // This file is distributed under the University of Illinois Open Source
8 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
36 // Skip asm prefix, if any. 'name' is usually taken directly from in CGBlockInfo()
62 /// buildBlockDescriptor - Build the block descriptor meta-data for a block.
63 /// buildBlockDescriptor is accessed from 5th field of the Block_literal
64 /// meta-data and contains stationary information about the block literal.
95 // FIXME: What is the right way to say this doesn't fit? We should give in buildBlockDescriptor()
110 // Signature. Mandatory ObjC-style method descriptor @encode sequence. in buildBlockDescriptor()
[all …]
/aosp_15_r20/external/rust/android-crates-io/crates/petgraph/src/
Dgenerate.rs9 // A DAG has the property that the adjacency matrix is lower triangular,
14 // The set of all DAG of a particular size is simply the power set of all
17 // For a graph of n=3 nodes we have (n - 1) * n / 2 = 3 possible edges.
19 /// A graph generator of “all” graphs of a particular size.
22 pub struct Generator<Ty> { struct
33 impl Generator<Directed> { argument
39 /// For a graph of *k* vertices there are *e = (k - 1) k / 2* possible edges and
41 pub fn directed_acyclic(nodes: usize) -> Self { in directed_acyclic()
43 let nedges = (nodes - 1) * nodes / 2; in directed_acyclic()
45 Generator { in directed_acyclic()
[all …]

12345678910>>...42