Rename get_namespaces() to namespaces()
This commit is contained in:
parent
d623fa32ab
commit
e03a6ea087
|
@ -1,7 +1,7 @@
|
||||||
use proc_macro2::{Ident, Span, TokenStream};
|
use proc_macro2::{Ident, Span, TokenStream};
|
||||||
use quote::{quote, ToTokens};
|
use quote::{quote, ToTokens};
|
||||||
|
|
||||||
use crate::{get_namespaces, retrieve_field_attribute, FieldAttribute};
|
use crate::{namespaces, retrieve_field_attribute, FieldAttribute};
|
||||||
|
|
||||||
struct Tokens {
|
struct Tokens {
|
||||||
enum_: TokenStream,
|
enum_: TokenStream,
|
||||||
|
@ -56,7 +56,7 @@ impl Deserializer {
|
||||||
let name = ident.to_string();
|
let name = ident.to_string();
|
||||||
let mut out = TokenStream::new();
|
let mut out = TokenStream::new();
|
||||||
|
|
||||||
let (default_namespace, other_namespaces) = get_namespaces(&input.attrs);
|
let (default_namespace, other_namespaces) = namespaces(&input.attrs);
|
||||||
let mut namespaces_map = quote!(let mut namespaces_map = std::collections::HashMap::new(););
|
let mut namespaces_map = quote!(let mut namespaces_map = std::collections::HashMap::new(););
|
||||||
|
|
||||||
for (k, v) in other_namespaces.iter() {
|
for (k, v) in other_namespaces.iter() {
|
||||||
|
|
|
@ -19,9 +19,7 @@ pub(crate) enum FieldAttribute {
|
||||||
Attribute,
|
Attribute,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_namespaces(
|
pub(crate) fn namespaces(attributes: &Vec<syn::Attribute>) -> (String, HashMap<String, String>) {
|
||||||
attributes: &Vec<syn::Attribute>,
|
|
||||||
) -> (String, HashMap<String, String>) {
|
|
||||||
let mut default_namespace = String::new();
|
let mut default_namespace = String::new();
|
||||||
let mut other_namespaces = HashMap::default();
|
let mut other_namespaces = HashMap::default();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::collections::HashMap;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
|
|
||||||
use crate::{get_namespaces, retrieve_field_attribute, FieldAttribute};
|
use crate::{namespaces, retrieve_field_attribute, FieldAttribute};
|
||||||
|
|
||||||
pub struct Serializer {
|
pub struct Serializer {
|
||||||
default_namespace: String,
|
default_namespace: String,
|
||||||
|
@ -12,7 +12,7 @@ pub struct Serializer {
|
||||||
|
|
||||||
impl<'a> Serializer {
|
impl<'a> Serializer {
|
||||||
pub fn new(attributes: &'a Vec<syn::Attribute>) -> Serializer {
|
pub fn new(attributes: &'a Vec<syn::Attribute>) -> Serializer {
|
||||||
let (default_namespace, other_namespaces) = get_namespaces(attributes);
|
let (default_namespace, other_namespaces) = namespaces(attributes);
|
||||||
|
|
||||||
Serializer {
|
Serializer {
|
||||||
default_namespace,
|
default_namespace,
|
||||||
|
|
Loading…
Reference in New Issue