Made field methods const fns (#823)

This commit is contained in:
Fisher Darling
2020-05-15 19:59:50 -06:00
committed by GitHub
parent 9de1360538
commit 8b67877cd5

View File

@@ -12,13 +12,13 @@ pub struct Field(u32);
impl Field {
/// Create a new field object for the given FieldId.
pub fn from_field_id(field_id: u32) -> Field {
pub const fn from_field_id(field_id: u32) -> Field {
Field(field_id)
}
/// Returns a u32 identifying uniquely a field within a schema.
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn field_id(&self) -> u32 {
pub const fn field_id(&self) -> u32 {
self.0
}
}