Giter Site home page Giter Site logo

Comments (8)

zhiburt avatar zhiburt commented on June 10, 2024 1

Understood.

Let me know if you'll encounter any difficulties on the second shot :)

If you don't mind I'll close the issue then.

And Yes.
Happy New Year.

from tabled.

zhiburt avatar zhiburt commented on June 10, 2024

Hi @nrdxp

Good observation,
I never thought about it.

Thank you for bringing this up and making the proposal.

I'll try to work on this tomorrow.

from tabled.

zhiburt avatar zhiburt commented on June 10, 2024

Hey @nrdxp

Could you show the exact type you're using?

Because I as see hiding fields in structs and tuples works well in master branch already. (surprisingly 😄)

The only issue I've spotted is when it's used in enum with #[field(inline)].
Is this your case?

Here's a bunch of tests

tabled/tests/derive_test.rs

Lines 593 to 715 in 061ccd7

#[test]
fn hidden_fields_may_not_implement_display() {
{
struct Something;
#[derive(Tabled)]
struct TupleStruct(#[header(hidden = true)] Something, &'static str);
let st = TupleStruct(Something, "nrdxp");
assert_eq!(vec!["nrdxp".to_owned()], st.fields());
assert_eq!(vec!["1".to_owned()], TupleStruct::headers());
}
{
struct Something;
#[derive(Tabled)]
struct Struct {
#[header(hidden = true)]
_gem: Something,
name: &'static str,
}
let st = Struct {
_gem: Something,
name: "nrdxp",
};
assert_eq!(vec!["nrdxp".to_owned()], st.fields());
assert_eq!(vec!["name".to_owned()], Struct::headers());
}
{
struct Something;
#[derive(Tabled)]
enum Enum {
#[field(inline("A::"))]
A {
name: &'static str,
},
#[field(inline("B::"))]
B {
issue: usize,
#[header(hidden = true)]
_gem: Something,
name: &'static str,
},
#[field(inline("C::"))]
C(usize, #[header(hidden = true)] Something, &'static str),
D,
}
assert_eq!(
vec![
"A::name".to_owned(),
"B::issue".to_owned(),
"B::name".to_owned(),
"C::0".to_owned(),
"C::2".to_owned(),
"D".to_owned()
],
Enum::headers()
);
let st = Enum::A { name: "nrdxp" };
assert_eq!(
vec![
"nrdxp".to_owned(),
"".to_owned(),
"".to_owned(),
"".to_owned(),
"".to_owned(),
"".to_owned()
],
st.fields()
);
let st = Enum::B {
_gem: Something,
issue: 32,
name: "nrdxp",
};
assert_eq!(
vec![
"".to_owned(),
"32".to_owned(),
"nrdxp".to_owned(),
"".to_owned(),
"".to_owned(),
"".to_owned()
],
st.fields()
);
let st = Enum::C(32, Something, "nrdxp");
assert_eq!(
vec![
"".to_owned(),
"".to_owned(),
"".to_owned(),
"32".to_owned(),
"nrdxp".to_owned(),
"".to_owned()
],
st.fields()
);
let st = Enum::D;
assert_eq!(
vec![
"".to_owned(),
"".to_owned(),
"".to_owned(),
"".to_owned(),
"".to_owned(),
"+".to_owned()
],
st.fields()
);
}
}

from tabled.

zhiburt avatar zhiburt commented on June 10, 2024

By they how do you think maybe its worth to rename hidden to ignore?

from tabled.

zhiburt avatar zhiburt commented on June 10, 2024

*Coincidentally was closed after #34 merge 😥

from tabled.

zhiburt avatar zhiburt commented on June 10, 2024

@nrdxp ping

from tabled.

zhiburt avatar zhiburt commented on June 10, 2024

ping

from tabled.

nrdxp avatar nrdxp commented on June 10, 2024

Hey sorry, my notifications got flooded with other things and I haven't seen any of this til now. Unfortunately I don't have any of the code I was using at the time left over, I switched to using prettytable-rs for the time being, although I would much prefer printing the tables directly from structs as this crate provides, rather than manually building the tables as I'm doing with prettytable, so I'd eventually like to give this another shot.

from tabled.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.