Home
last modified time | relevance | path

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

12345678910>>...14

/external/pigweed/pw_format/rust/
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 …]
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 …]
Dpw_format_test_macros_printf_test.rs7 // https://www.apache.org/licenses/LICENSE-2.0
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 // Used to record calls into the test generator from `generator_test_macro!`.
34 // Used to record calls into the test generator from `printf_generator_test_macro!` and friends.
64 fn generate_calls_generator_correctly() { in generate_calls_generator_correctly()
91 fn generate_printf_calls_generator_correctly() { in generate_printf_calls_generator_correctly()
127 fn generate_printf_translates_field_width_and_leading_zeros_correctly() { in generate_printf_translates_field_width_and_leading_zeros_correctly()
164 fn generate_core_fmt_translates_field_width_and_leading_zeros_correctly() { in generate_core_fmt_translates_field_width_and_leading_zeros_correctly()
200 // Test that a generator returning an overridden integer conversion specifier
203 fn generate_printf_substitutes_integer_conversion() { in generate_printf_substitutes_integer_conversion()
[all …]
/external/pigweed/pw_format/rust/pw_format/
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 …]
/external/rust/crates/clap_complete/src/generator/
Dmod.rs13 /// Generator trait which can be used to write generators
14 pub trait Generator { trait
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 …]
/external/rust/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.
48 //! To get reproducible results on every run, initialize the generator with a seed:
58 //! To be more efficient, create a new [`Rng`] instance instead of using the thread-local
59 //! generator:
83 /// A random number generator.
89 fn default() -> Rng { in default()
95 /// Clones the generator by deterministically deriving a new generator based on the initial
104 /// base1.bool(); // Use the generator once.
[all …]
/external/pigweed/pw_tokenizer/rust/
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 …]
/external/rust/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 …]
/external/pigweed/pw_log/rust/
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 …]
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 …]
/external/crosvm/common/audio_streams/src/
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 …]
/external/rust/crates/openssl/src/
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 …]
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 …]
/external/rust/crates/clap_complete/src/
Dlib.rs1 // Copyright ⓒ 2015-2018 Kevin B. Knapp
3 // `clap_complete` is distributed under the terms of both the MIT license and the Apache License
5 // See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files in this repository
8 #![doc(html_logo_url = "https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png")]
17 //! - For generating at compile-time, see [`generate_to`]
18 //! - For generating at runtime, see [`generate`]
20 //! [`Shell`] is a convenience `enum` for an argument value type that implements `Generator`
21 //! for each natively-supported shell type.
27 //! use clap_complete::{generate, Generator, Shell};
30 //! fn build_cli() -> Command {
[all …]
/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 …]
/external/rust/crates/tokio/src/util/
Drand.rs23 /// Implement xorshift64+: 2 32-bit xorshift sequences added together.
26 /// This generator passes the SmallCrush suite, part of TestU01 framework:
36 pub(crate) fn new() -> Self { in new()
40 fn from_u64(seed: u64) -> Self { in from_u64()
52 fn from_pair(s: u32, r: u32) -> Self { in from_pair()
58 /// Initialize a new fast random number generator using the default source of entropy.
59 pub(crate) fn new() -> FastRand { in new()
63 /// Initializes a new, thread-local, fast random number generator.
64 pub(crate) fn from_seed(seed: RngSeed) -> FastRand { in from_seed()
73 feature = "rt-multi-thread",
[all …]
/external/libopus/dnn/torch/fwgan/
Dinference.py20 def preemphasis(x, coef= -0.85):
24 def deemphasis(x, coef= -0.85):
29 weighting_vector = np.array([gamma**i for i in range(16,0,-1)])
43 s = inp[i] - np.dot(buffer*weighting_vector, filt)
47 buffer = np.roll(buffer, -1)
69 buffer[:] = out_sig_frame[-16:]
74 def process_item(generator, feature_filename, output_filename, verbose=False): argument
86 .astype('int32')).type(torch.long).view(1,-1)#.to(device)
88 lpc_filters = np.copy(feat[:, -16:])
91 …x1 = generator(period, bfcc_with_corr, torch.zeros(1,320)) #this means the vocoder runs in complet…
[all …]
/external/rust/crates/clap_complete/examples/
Dcompletion.rs5 //! $ cargo run --example completion -- --generate=zsh > /usr/local/share/zsh/site-functions/_compl…
7 //! $ ./target/debug/examples/completion --<TAB>
11 //! $ cargo run --example completion -- --generate=fish > completion.fish
13 //! $ ./target/debug/examples/completion --<TAB>
16 use clap_complete::{generate, Generator, Shell};
19 fn build_cli() -> Command { in build_cli()
20 let value_hint_command = Command::new("value-hint") in build_cli()
54 .long("cmd-name") in build_cli()
66 // AppSettings::TrailingVarArg is required to use ValueHint::CommandWithArguments in build_cli()
90 Arg::new("generator") in build_cli()
[all …]
/external/rust/crates/clap_complete/src/shells/
Dfish.rs5 use crate::generator::{utils, Generator};
9 /// Note: The fish generator currently only supports named options (-o/--option), not positional ar…
13 impl Generator for Fish {
14 fn file_name(&self, name: &str) -> String { in file_name()
18 fn generate(&self, cmd: &Command, buf: &mut dyn Write) { in generate()
30 fn escape_string(string: &str, escape_comma: bool) -> String { in escape_string()
39 fn gen_fish_inner(
49 // -c {command}
50 // -d "{description}"
51 // -s {short}
[all …]
Dpowershell.rs6 use crate::generator::{utils, Generator};
13 impl Generator for PowerShell {
14 fn file_name(&self, name: &str) -> String { in file_name()
18 fn generate(&self, cmd: &Command, buf: &mut dyn Write) { in generate()
30 Register-ArgumentCompleter -Native -CommandName '{bin_name}' -ScriptBlock {{ in generate()
36 for ($i = 1; $i -lt $commandElements.Count; $i++) {{ in generate()
38 if ($element -isnot [StringConstantExpressionAst] -or in generate()
39 $element.StringConstantType -ne [StringConstantType]::BareWord -or in generate()
40 $element.Value.StartsWith('-') -or in generate()
41 $element.Value -eq $wordToComplete) {{ in generate()
[all …]
/external/rust/crates/rand/src/rngs/
Dthread.rs3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
9 //! Thread-local random number generator
25 // single thread (which is the definition of `ThreadRng`), there will only ever
28 // A possible scenario where there could be multiple mutable references is if
29 // `ThreadRng` is used inside `next_u32` and co. But the implementation is
31 // `ThreadRng` internally, which is nonsensical anyway. We should also never run
32 // `ThreadRng` in destructors of its implementation, which is also nonsensical.
40 /// A reference to the thread-local generator
[all …]
Dmock.rs3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
9 //! Mock random number generator
19 /// over a `u64` number, using wrapping arithmetic. If the increment is 0
20 /// the generator yields a constant.
40 pub fn new(initial: u64, increment: u64) -> Self { in new()
50 fn next_u32(&mut self) -> u32 { in next_u32()
55 fn next_u64(&mut self) -> u64 { in next_u64()
62 fn fill_bytes(&mut self, dest: &mut [u8]) { in fill_bytes()
[all …]
Dxoshiro128plusplus.rs3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
14 /// A xoshiro128++ random number generator.
16 /// The xoshiro128++ algorithm is not suitable for cryptographic purposes, but
17 /// is very fast and has excellent statistical properties.
19 /// The algorithm used here is translated from [the `xoshiro128plusplus.c`
31 /// Create a new `Xoshiro128PlusPlus`. If `seed` is entirely 0, it will be
34 fn from_seed(seed: [u8; 16]) -> Xoshiro128PlusPlus { in from_seed()
45 /// This uses the SplitMix64 generator internally.
[all …]
/external/rust/crates/rand_core/src/
Dos.rs3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
9 //! Interface to the random number generator of the operating system.
14 /// A random number generator that retrieves randomness from the
17 /// This is a zero-sized struct. It can be freely constructed with `OsRng`.
19 /// The implementation is provided by the [getrandom] crate. Refer to
22 /// This struct is only available when specifying the crate feature `getrandom`
23 /// or `std`. When using the `rand` lib, it is also available as `rand::rngs::OsRng`.
27 /// It is possible that when used during early boot the first call to `OsRng`
[all …]
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 …]

12345678910>>...14