MCPcopy Create free account
hub / github.com/dtolnay/thiserror / derive

Function derive

impl/src/expand.rs:12–20  ·  view source on GitHub ↗
(input: &DeriveInput)

Source from the content-addressed store, hash-verified

10use syn::{DeriveInput, GenericArgument, PathArguments, Result, Token, Type};
11
12pub fn derive(input: &DeriveInput) -> TokenStream {
13 match try_expand(input) {
14 Ok(expanded) => expanded,
15 // If there are invalid attributes in the input, expand to an Error impl
16 // anyway to minimize spurious secondary errors in other code that uses
17 // this type as an Error.
18 Err(error) => fallback::expand(input, error),
19 }
20}
21
22fn try_expand(input: &DeriveInput) -> Result<TokenStream> {
23 let input = Input::from_syn(input)?;

Callers 1

derive_errorFunction · 0.85

Calls 2

try_expandFunction · 0.85
expandFunction · 0.85

Tested by

no test coverage detected