Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Tabled trait from Vec to [_; Self::LENGTH] #276

Open
zhiburt opened this issue Jan 31, 2023 · 2 comments
Open

Switch Tabled trait from Vec to [_; Self::LENGTH] #276

zhiburt opened this issue Jan 31, 2023 · 2 comments
Labels

Comments

@zhiburt
Copy link
Owner

zhiburt commented Jan 31, 2023

Just short idea came to me that we could switch to a constant vector.
And everything will be fine.

The only question I've not investigated is.
Is there ANY reason why we shall stick with Vec?

tabled/src/tabled.rs

Lines 10 to 21 in 27ba1ca

pub trait Tabled {
/// A length of fields and headers,
/// which must be the same.
const LENGTH: usize;
/// Fields method must return a list of cells.
///
/// The cells will be placed in the same row, preserving the order.
fn fields(&self) -> Vec<Cow<'_, str>>;
/// Headers must return a list of column names.
fn headers() -> Vec<Cow<'static, str>>;
}

@zhiburt zhiburt changed the title Switch Tabled trait from Vec to [_; Self::LENGTH] Switch Tabled trait from Vec to [_; Self::LENGTH] Jan 31, 2023
@zhiburt
Copy link
Owner Author

zhiburt commented Feb 1, 2023

Seems fine to do so.

@zhiburt
Copy link
Owner Author

zhiburt commented Feb 10, 2023

Yet not possible cause rust-lang/rust#60551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant