1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
//!
//! Structures and functions for handling `syn::punctuated::Punctuated` collections.
//!
//! This module provides functionality to manipulate and ensure correct punctuation in `syn::punctuated::Punctuated` collections, commonly used in procedural macros to represent sequences of elements separated by punctuation marks, such as commas.
//!
/// Internal namespace.
pub( crate ) mod private
{
/// Ensures that a `syn::punctuated::Punctuated` collection ends with a comma if it contains elements.
pub fn ensure_trailing_comma< T : Clone >
( punctuated : &mut syn::punctuated::Punctuated< T, syn::token::Comma > )
{
if !punctuated.empty_or_trailing()
{
punctuated.push_punct( syn::token::Comma::default() );
}
}
}
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use own::*;
#[ allow( unused_imports ) ]
/// Own namespace of the module.
pub mod own
{
use super::*;
#[ doc( inline ) ]
pub use orphan::*;
#[ doc( inline ) ]
pub use private::
{
ensure_trailing_comma,
};
}
/// Orphan namespace of the module.
#[ allow( unused_imports ) ]
pub mod orphan
{
use super::*;
#[ doc( inline ) ]
pub use exposed::*;
}
/// Exposed namespace of the module.
#[ allow( unused_imports ) ]
pub mod exposed
{
use super::*;
pub use super::super::punctuated;
// pub use super::own as punctuated;
#[ doc( inline ) ]
#[ allow( unused_imports ) ]
pub use super::
{
prelude::*,
};
}
/// Prelude to use essentials: `use my_module::prelude::*`.
#[ allow( unused_imports ) ]
pub mod prelude
{
use super::*;
}