fn extract_runtime_block_ident(trait_: &Path) -> Result<&TypePath> {
	let span = trait_.span();
	let segment = trait_
		.segments
		.last()
		.ok_or_else(
			|| Error::new(span, "Empty path not supported")
		)?;
	let generics = segment.value();

	match &generics.arguments {
		PathArguments::AngleBracketed(ref args) => {
			args.args.first().and_then(|v| match v.value() {
			GenericArgument::Type(Type::Path(block)) => Some(block),
				_ => None
			}).ok_or_else(|| Error::new(args.span(), "Missing `Block` generic parameter."))
		},
		PathArguments::None => {
			let span = trait_.segments.last().as_ref().unwrap().value().span();
			Err(Error::new(span, "Missing `Block` generic parameter."))
		},
		PathArguments::Parenthesized(_) => {
			Err(Error::new(generics.arguments.span(), "Unexpected parentheses in path!"))
		}
	}
}
/// Extracts the runtime block identifier.
Extracts the runtime block identifier.
Extracts the runtime block identifier .
fn extract_runtime_block_ident(trait_: &Path) -> Result<&TypePath> {
	let span = trait_.span();
	let segment = trait_
		.segments
		.last()
		.ok_or_else(
			|| Error::new(span, "Empty path not supported")
		)?;
	let generics = segment.value();
	match &generics.arguments {
		PathArguments::AngleBracketed(ref args) => {
			args.args.first().and_then(|v| match v.value() {
			GenericArgument::Type(Type::Path(block)) => Some(block),
				_ => None
			}).ok_or_else(|| Error::new(args.span(), "Missing `Block` generic parameter."))
		},
		PathArguments::None => {
			let span = trait_.segments.last().as_ref().unwrap().value().span();
			Err(Error::new(span, "Missing `Block` generic parameter."))
		},
		PathArguments::Parenthesized(_) => {
			Err(Error::new(generics.arguments.span(), "Unexpected parentheses in path!"))
		}
	}
}
fn extract_runtime_block_ident ( trait_ : & Path ) -> Result < & TypePath > { let span = trait_ . span ( ) ; let segment = trait_ . segments . last ( ) . ok_or_else ( | | Error :: new ( span , " " ) ) ? ; let generics = segment . value ( ) ; match & generics . arguments { PathArguments :: AngleBracketed ( ref args ) => { args . args . first ( ) . and_then ( | v | match v . value ( ) { GenericArgument :: Type ( Type :: Path ( block ) ) => Some ( block ) , _ => None } ) . ok_or_else ( | | Error :: new ( args . span ( ) , " " ) ) } , PathArguments :: None => { let span = trait_ . segments . last ( ) . as_ref ( ) . unwrap ( ) . value ( ) . span ( ) ; Err ( Error :: new ( span , " " ) ) } , PathArguments :: Parenthesized ( _ ) => { Err ( Error :: new ( generics . arguments . span ( ) , " " ) ) } } }
Extracts the runtime block identifier.
Extracts the runtime block identifier .
trait_
&Path
trait_
&Path