Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Made API to create field accept String (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao authored Nov 28, 2021
1 parent 35dfab3 commit f2c7503
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/datatypes/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ impl PartialEq for Field {
}

impl Field {
/// Creates a new field
pub fn new(name: &str, data_type: DataType, nullable: bool) -> Self {
/// Creates a new [`Field`].
pub fn new<T: Into<String>>(name: T, data_type: DataType, nullable: bool) -> Self {
Field {
name: name.to_string(),
name: name.into(),
data_type,
nullable,
dict_id: 0,
Expand All @@ -73,15 +73,15 @@ impl Field {
}

/// Creates a new field
pub fn new_dict(
name: &str,
pub fn new_dict<T: Into<String>>(
name: T,
data_type: DataType,
nullable: bool,
dict_id: i64,
dict_is_ordered: bool,
) -> Self {
Field {
name: name.to_string(),
name: name.into(),
data_type,
nullable,
dict_id,
Expand Down
5 changes: 3 additions & 2 deletions src/datatypes/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ use super::Field;
/// An ordered sequence of [`Field`] with optional metadata.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Schema {
pub(crate) fields: Vec<Field>,
/// The fields composing this schema.
pub fields: Vec<Field>,
/// A map of key-value pairs containing additional meta data.
pub(crate) metadata: HashMap<String, String>,
pub metadata: HashMap<String, String>,
}

impl Schema {
Expand Down

0 comments on commit f2c7503

Please sign in to comment.