• Home
  • Raw
  • Download

Lines Matching refs:cx

26     cx: &'c Ctxt,  field
33 fn none(cx: &'c Ctxt, name: Symbol) -> Self { in none()
35 cx, in none()
46 self.cx in set()
81 fn none(cx: &'c Ctxt, name: Symbol) -> Self { in none()
82 BoolAttr(Attr::none(cx, name)) in none()
95 cx: &'c Ctxt, field
102 fn none(cx: &'c Ctxt, name: Symbol) -> Self { in none()
104 cx, in none()
121 self.cx.error_spanned_by( in at_most_one()
290 pub fn from_ast(cx: &Ctxt, item: &syn::DeriveInput) -> Self { in from_ast()
291 let mut ser_name = Attr::none(cx, RENAME); in from_ast()
292 let mut de_name = Attr::none(cx, RENAME); in from_ast()
293 let mut transparent = BoolAttr::none(cx, TRANSPARENT); in from_ast()
294 let mut deny_unknown_fields = BoolAttr::none(cx, DENY_UNKNOWN_FIELDS); in from_ast()
295 let mut default = Attr::none(cx, DEFAULT); in from_ast()
296 let mut rename_all_ser_rule = Attr::none(cx, RENAME_ALL); in from_ast()
297 let mut rename_all_de_rule = Attr::none(cx, RENAME_ALL); in from_ast()
298 let mut ser_bound = Attr::none(cx, BOUND); in from_ast()
299 let mut de_bound = Attr::none(cx, BOUND); in from_ast()
300 let mut untagged = BoolAttr::none(cx, UNTAGGED); in from_ast()
301 let mut internal_tag = Attr::none(cx, TAG); in from_ast()
302 let mut content = Attr::none(cx, CONTENT); in from_ast()
303 let mut type_from = Attr::none(cx, FROM); in from_ast()
304 let mut type_try_from = Attr::none(cx, TRY_FROM); in from_ast()
305 let mut type_into = Attr::none(cx, INTO); in from_ast()
306 let mut remote = Attr::none(cx, REMOTE); in from_ast()
307 let mut field_identifier = BoolAttr::none(cx, FIELD_IDENTIFIER); in from_ast()
308 let mut variant_identifier = BoolAttr::none(cx, VARIANT_IDENTIFIER); in from_ast()
309 let mut serde_path = Attr::none(cx, CRATE); in from_ast()
310 let mut expecting = Attr::none(cx, EXPECTING); in from_ast()
315 .flat_map(|attr| get_serde_meta_items(cx, attr)) in from_ast()
321 if let Ok(s) = get_lit_str(cx, RENAME, &m.lit) { in from_ast()
329 if let Ok((ser, de)) = get_renames(cx, &m.nested) { in from_ast()
337 if let Ok(s) = get_lit_str(cx, RENAME_ALL, &m.lit) { in from_ast()
343 Err(err) => cx.error_spanned_by(s, err), in from_ast()
350 if let Ok((ser, de)) = get_renames(cx, &m.nested) { in from_ast()
354 Err(err) => cx.error_spanned_by(ser, err), in from_ast()
360 Err(err) => cx.error_spanned_by(de, err), in from_ast()
382 syn::Fields::Unnamed(_) | syn::Fields::Unit => cx.error_spanned_by( in from_ast()
387 syn::Data::Enum(syn::DataEnum { enum_token, .. }) => cx.error_spanned_by( in from_ast()
391 syn::Data::Union(syn::DataUnion { union_token, .. }) => cx.error_spanned_by( in from_ast()
399 if let Ok(path) = parse_lit_into_expr_path(cx, DEFAULT, &m.lit) { in from_ast()
406 syn::Fields::Unnamed(_) | syn::Fields::Unit => cx in from_ast()
413 syn::Data::Enum(syn::DataEnum { enum_token, .. }) => cx in from_ast()
420 }) => cx.error_spanned_by( in from_ast()
430 if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit) { in from_ast()
438 if let Ok((ser, de)) = get_where_predicates(cx, &m.nested) { in from_ast()
450 cx.error_spanned_by( in from_ast()
456 cx.error_spanned_by( in from_ast()
465 if let Ok(s) = get_lit_str(cx, TAG, &m.lit) { in from_ast()
475 cx.error_spanned_by( in from_ast()
482 cx.error_spanned_by( in from_ast()
493 if let Ok(s) = get_lit_str(cx, CONTENT, &m.lit) { in from_ast()
499 cx.error_spanned_by( in from_ast()
505 cx.error_spanned_by( in from_ast()
516 if let Ok(from_ty) = parse_lit_into_ty(cx, FROM, &m.lit) { in from_ast()
523 if let Ok(try_from_ty) = parse_lit_into_ty(cx, TRY_FROM, &m.lit) { in from_ast()
530 if let Ok(into_ty) = parse_lit_into_ty(cx, INTO, &m.lit) { in from_ast()
537 if let Ok(path) = parse_lit_into_path(cx, REMOTE, &m.lit) { in from_ast()
558 if let Ok(path) = parse_lit_into_path(cx, CRATE, &m.lit) { in from_ast()
565 if let Ok(s) = get_lit_str(cx, EXPECTING, &m.lit) { in from_ast()
576 cx.error_spanned_by( in from_ast()
583 cx.error_spanned_by(lit, "unexpected literal in serde container attribute"); in from_ast()
613 tag: decide_tag(cx, item, untagged, internal_tag, content), in from_ast()
618 identifier: decide_identifier(cx, item, field_identifier, variant_identifier), in from_ast()
707 cx: &Ctxt, in decide_tag()
728 cx.error_spanned_by( in decide_tag()
741 cx.error_spanned_by( in decide_tag()
745 cx.error_spanned_by( in decide_tag()
752 cx.error_spanned_by( in decide_tag()
759 cx.error_spanned_by( in decide_tag()
763 cx.error_spanned_by( in decide_tag()
771 cx.error_spanned_by( in decide_tag()
775 cx.error_spanned_by( in decide_tag()
779 cx.error_spanned_by( in decide_tag()
789 cx: &Ctxt, in decide_identifier()
801 cx.error_spanned_by( in decide_identifier()
805 cx.error_spanned_by( in decide_identifier()
814 cx.error_spanned_by( in decide_identifier()
821 cx.error_spanned_by( in decide_identifier()
828 cx.error_spanned_by( in decide_identifier()
835 cx.error_spanned_by( in decide_identifier()
859 pub fn from_ast(cx: &Ctxt, variant: &syn::Variant) -> Self { in from_ast()
860 let mut ser_name = Attr::none(cx, RENAME); in from_ast()
861 let mut de_name = Attr::none(cx, RENAME); in from_ast()
862 let mut de_aliases = VecAttr::none(cx, RENAME); in from_ast()
863 let mut skip_deserializing = BoolAttr::none(cx, SKIP_DESERIALIZING); in from_ast()
864 let mut skip_serializing = BoolAttr::none(cx, SKIP_SERIALIZING); in from_ast()
865 let mut rename_all_ser_rule = Attr::none(cx, RENAME_ALL); in from_ast()
866 let mut rename_all_de_rule = Attr::none(cx, RENAME_ALL); in from_ast()
867 let mut ser_bound = Attr::none(cx, BOUND); in from_ast()
868 let mut de_bound = Attr::none(cx, BOUND); in from_ast()
869 let mut other = BoolAttr::none(cx, OTHER); in from_ast()
870 let mut serialize_with = Attr::none(cx, SERIALIZE_WITH); in from_ast()
871 let mut deserialize_with = Attr::none(cx, DESERIALIZE_WITH); in from_ast()
872 let mut borrow = Attr::none(cx, BORROW); in from_ast()
877 .flat_map(|attr| get_serde_meta_items(cx, attr)) in from_ast()
883 if let Ok(s) = get_lit_str(cx, RENAME, &m.lit) { in from_ast()
892 if let Ok((ser, de)) = get_multiple_renames(cx, &m.nested) { in from_ast()
903 if let Ok(s) = get_lit_str(cx, ALIAS, &m.lit) { in from_ast()
910 if let Ok(s) = get_lit_str(cx, RENAME_ALL, &m.lit) { in from_ast()
916 Err(err) => cx.error_spanned_by(s, err), in from_ast()
923 if let Ok((ser, de)) = get_renames(cx, &m.nested) { in from_ast()
927 Err(err) => cx.error_spanned_by(ser, err), in from_ast()
933 Err(err) => cx.error_spanned_by(de, err), in from_ast()
962 if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit) { in from_ast()
970 if let Ok((ser, de)) = get_where_predicates(cx, &m.nested) { in from_ast()
978 if let Ok(path) = parse_lit_into_expr_path(cx, WITH, &m.lit) { in from_ast()
996 if let Ok(path) = parse_lit_into_expr_path(cx, SERIALIZE_WITH, &m.lit) { in from_ast()
1003 if let Ok(path) = parse_lit_into_expr_path(cx, DESERIALIZE_WITH, &m.lit) { in from_ast()
1014 cx.error_spanned_by( in from_ast()
1027 cx.error_spanned_by( in from_ast()
1034 cx.error_spanned_by(lit, "unexpected literal in serde variant attribute"); in from_ast()
1145 cx: &Ctxt, in from_ast()
1151 let mut ser_name = Attr::none(cx, RENAME); in from_ast()
1152 let mut de_name = Attr::none(cx, RENAME); in from_ast()
1153 let mut de_aliases = VecAttr::none(cx, RENAME); in from_ast()
1154 let mut skip_serializing = BoolAttr::none(cx, SKIP_SERIALIZING); in from_ast()
1155 let mut skip_deserializing = BoolAttr::none(cx, SKIP_DESERIALIZING); in from_ast()
1156 let mut skip_serializing_if = Attr::none(cx, SKIP_SERIALIZING_IF); in from_ast()
1157 let mut default = Attr::none(cx, DEFAULT); in from_ast()
1158 let mut serialize_with = Attr::none(cx, SERIALIZE_WITH); in from_ast()
1159 let mut deserialize_with = Attr::none(cx, DESERIALIZE_WITH); in from_ast()
1160 let mut ser_bound = Attr::none(cx, BOUND); in from_ast()
1161 let mut de_bound = Attr::none(cx, BOUND); in from_ast()
1162 let mut borrowed_lifetimes = Attr::none(cx, BORROW); in from_ast()
1163 let mut getter = Attr::none(cx, GETTER); in from_ast()
1164 let mut flatten = BoolAttr::none(cx, FLATTEN); in from_ast()
1178 .flat_map(|attr| get_serde_meta_items(cx, attr)) in from_ast()
1185 if let Ok(s) = get_lit_str(cx, RENAME, &m.lit) { in from_ast()
1194 if let Ok((ser, de)) = get_multiple_renames(cx, &m.nested) { in from_ast()
1205 if let Ok(s) = get_lit_str(cx, ALIAS, &m.lit) { in from_ast()
1217 if let Ok(path) = parse_lit_into_expr_path(cx, DEFAULT, &m.lit) { in from_ast()
1240 if let Ok(path) = parse_lit_into_expr_path(cx, SKIP_SERIALIZING_IF, &m.lit) { in from_ast()
1247 if let Ok(path) = parse_lit_into_expr_path(cx, SERIALIZE_WITH, &m.lit) { in from_ast()
1254 if let Ok(path) = parse_lit_into_expr_path(cx, DESERIALIZE_WITH, &m.lit) { in from_ast()
1261 if let Ok(path) = parse_lit_into_expr_path(cx, WITH, &m.lit) { in from_ast()
1279 if let Ok(where_predicates) = parse_lit_into_where(cx, BOUND, BOUND, &m.lit) { in from_ast()
1287 if let Ok((ser, de)) = get_where_predicates(cx, &m.nested) { in from_ast()
1295 if let Ok(borrowable) = borrowable_lifetimes(cx, &ident, field) { in from_ast()
1302 if let Ok(lifetimes) = parse_lit_into_lifetimes(cx, BORROW, &m.lit) { in from_ast()
1303 if let Ok(borrowable) = borrowable_lifetimes(cx, &ident, field) { in from_ast()
1306 cx.error_spanned_by( in from_ast()
1322 if let Ok(path) = parse_lit_into_expr_path(cx, GETTER, &m.lit) { in from_ast()
1338 cx.error_spanned_by( in from_ast()
1345 cx.error_spanned_by(lit, "unexpected literal in serde field attribute"); in from_ast()
1501 cx: &'b Ctxt, in get_ser_and_de()
1510 let mut ser_meta = VecAttr::none(cx, attr_name); in get_ser_and_de()
1511 let mut de_meta = VecAttr::none(cx, attr_name); in get_ser_and_de()
1516 if let Ok(v) = f(cx, attr_name, SERIALIZE, &meta.lit) { in get_ser_and_de()
1522 if let Ok(v) = f(cx, attr_name, DESERIALIZE, &meta.lit) { in get_ser_and_de()
1528 cx.error_spanned_by( in get_ser_and_de()
1544 cx: &Ctxt, in get_renames()
1547 let (ser, de) = get_ser_and_de(cx, RENAME, items, get_lit_str2)?; in get_renames()
1552 cx: &Ctxt, in get_multiple_renames()
1555 let (ser, de) = get_ser_and_de(cx, RENAME, items, get_lit_str2)?; in get_multiple_renames()
1560 cx: &Ctxt, in get_where_predicates()
1563 let (ser, de) = get_ser_and_de(cx, BOUND, items, parse_lit_into_where)?; in get_where_predicates()
1567 pub fn get_serde_meta_items(cx: &Ctxt, attr: &syn::Attribute) -> Result<Vec<syn::NestedMeta>, ()> { in get_serde_meta_items()
1575 cx.error_spanned_by(other, "expected #[serde(...)]"); in get_serde_meta_items()
1579 cx.syn_error(err); in get_serde_meta_items()
1585 fn get_lit_str<'a>(cx: &Ctxt, attr_name: Symbol, lit: &'a syn::Lit) -> Result<&'a syn::LitStr, ()> { in get_lit_str()
1586 get_lit_str2(cx, attr_name, attr_name, lit) in get_lit_str()
1590 cx: &Ctxt, in get_lit_str2()
1598 cx.error_spanned_by( in get_lit_str2()
1609 fn parse_lit_into_path(cx: &Ctxt, attr_name: Symbol, lit: &syn::Lit) -> Result<syn::Path, ()> { in parse_lit_into_path()
1610 let string = get_lit_str(cx, attr_name, lit)?; in parse_lit_into_path()
1612 cx.error_spanned_by(lit, format!("failed to parse path: {:?}", string.value())) in parse_lit_into_path()
1617 cx: &Ctxt, in parse_lit_into_expr_path()
1621 let string = get_lit_str(cx, attr_name, lit)?; in parse_lit_into_expr_path()
1623 cx.error_spanned_by(lit, format!("failed to parse path: {:?}", string.value())) in parse_lit_into_expr_path()
1628 cx: &Ctxt, in parse_lit_into_where()
1633 let string = get_lit_str2(cx, attr_name, meta_item_name, lit)?; in parse_lit_into_where()
1642 .map_err(|err| cx.error_spanned_by(lit, err)) in parse_lit_into_where()
1645 fn parse_lit_into_ty(cx: &Ctxt, attr_name: Symbol, lit: &syn::Lit) -> Result<syn::Type, ()> { in parse_lit_into_ty()
1646 let string = get_lit_str(cx, attr_name, lit)?; in parse_lit_into_ty()
1649 cx.error_spanned_by( in parse_lit_into_ty()
1659 cx: &Ctxt, in parse_lit_into_lifetimes()
1663 let string = get_lit_str(cx, attr_name, lit)?; in parse_lit_into_lifetimes()
1665 cx.error_spanned_by(lit, "at least one lifetime must be borrowed"); in parse_lit_into_lifetimes()
1681 cx.error_spanned_by(lit, format!("duplicate borrowed lifetime `{}`", lifetime)); in parse_lit_into_lifetimes()
1687 cx.error_spanned_by( in parse_lit_into_lifetimes()
1838 cx: &Ctxt, in borrowable_lifetimes()
1845 cx.error_spanned_by( in borrowable_lifetimes()