pub struct PostgresTypeDerive { /* private fields */ }
Expand description
A parsed #[derive(PostgresType)]
item.
It should be used with syn::parse::Parse
functions.
Using quote::ToTokens
will output the declaration for a PostgresTypeEntity
.
use syn::{Macro, parse::Parse, parse_quote, parse};
use quote::{quote, ToTokens};
use pgrx_sql_entity_graph::PostgresTypeDerive;
use pgrx_sql_entity_graph::CodeEnrichment;
let parsed: CodeEnrichment<PostgresTypeDerive> = parse_quote! {
#[derive(PostgresType)]
struct Example<'a> {
demo: &'a str,
}
};
let sql_graph_entity_tokens = parsed.to_token_stream();
Implementations§
Source§impl PostgresTypeDerive
impl PostgresTypeDerive
pub fn new( name: Ident, generics: Generics, in_fn: Ident, out_fn: Ident, to_sql_config: ToSqlConfig, ) -> Result<CodeEnrichment<Self>, Error>
pub fn from_derive_input( derive_input: DeriveInput, ) -> Result<CodeEnrichment<Self>, Error>
Trait Implementations§
Source§impl Clone for PostgresTypeDerive
impl Clone for PostgresTypeDerive
Source§fn clone(&self) -> PostgresTypeDerive
fn clone(&self) -> PostgresTypeDerive
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for PostgresTypeDerive
impl RefUnwindSafe for PostgresTypeDerive
impl !Send for PostgresTypeDerive
impl !Sync for PostgresTypeDerive
impl Unpin for PostgresTypeDerive
impl UnwindSafe for PostgresTypeDerive
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more