Sha256: 22910bf0521ab868ebd7c62601c55912d12cfb400c65723e08e5cfa3a2d111c0

Contents?: true

Size: 390 Bytes

Versions: 33

Compression:

Stored size: 390 Bytes

Contents

use proc_macro2::TokenStream;
use quote::ToTokens;

pub(crate) struct TokensOrDefault<'a, T: 'a>(pub &'a Option<T>);

impl<'a, T> ToTokens for TokensOrDefault<'a, T>
where
    T: ToTokens + Default,
{
    fn to_tokens(&self, tokens: &mut TokenStream) {
        match self.0 {
            Some(t) => t.to_tokens(tokens),
            None => T::default().to_tokens(tokens),
        }
    }
}

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
wasmtime-14.0.3 ./ext/cargo-vendor/syn-2.0.38/src/print.rs
wasmtime-14.0.1 ./ext/cargo-vendor/syn-2.0.38/src/print.rs
wasmtime-14.0.0 ./ext/cargo-vendor/syn-2.0.38/src/print.rs
wasmtime-13.0.0 ./ext/cargo-vendor/syn-2.0.29/src/print.rs
wasmtime-12.0.1 ./ext/cargo-vendor/syn-2.0.29/src/print.rs
wasmtime-12.0.0 ./ext/cargo-vendor/syn-2.0.29/src/print.rs
wasmtime-11.0.0 ./ext/cargo-vendor/syn-2.0.29/src/print.rs
wasmtime-10.0.1 ./ext/cargo-vendor/syn-2.0.28/src/print.rs
wasmtime-10.0.0 ./ext/cargo-vendor/syn-2.0.28/src/print.rs
wasmtime-9.0.4 ./ext/cargo-vendor/syn-2.0.28/src/print.rs
wasmtime-9.0.1 ./ext/cargo-vendor/syn-2.0.16/src/print.rs
wasmtime-8.0.0 ./ext/cargo-vendor/syn-2.0.15/src/print.rs
wasmtime-7.0.0 ./ext/cargo-vendor/syn-2.0.12/src/print.rs