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

Cannot use sheets from branch sheets/saint-coinach with branch main's excel. #26

Open
IAMSolaara opened this issue May 23, 2024 · 3 comments

Comments

@IAMSolaara
Copy link

Hello,
I updated a project of mine to use ironworks' main branch and need to use Excel sheets.

Using let sheet = excel.sheet(for_type::<ironworks_sheets::sheet::LogMessage>())?; gives compile-time errors because of SheetType not implementing the Display trait.

This is the error message I get:

error[E0277]: `ironworks_sheets::metadata::SheetType<LogMessage>` doesn't implement `std::fmt::Display`
  --> src/main.rs:32:29
   |
32 |     let sheet = excel.sheet(for_type::<ironworks_sheets::sheet::LogMessage>())?;
   |                       ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ironworks_sheets::metadata::SheetType<LogMessage>` cannot be formatted with the default formatter
   |                       |
   |                       required by a bound introduced by this call
   |
   = help: the trait `std::fmt::Display` is not implemented for `ironworks_sheets::metadata::SheetType<LogMessage>`, which is required by `ironworks_sheets::metadata::SheetType<LogMessage>: SheetMetadata`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
   = note: required for `ironworks_sheets::metadata::SheetType<LogMessage>` to implement `ToString`
   = note: required for `ironworks_sheets::metadata::SheetType<LogMessage>` to implement `SheetMetadata`
note: required by a bound in `Excel::<'i>::sheet`
  --> /Users/evermore/Workspace/Code/scratch/ironworks/ironworks/src/excel/excel.rs:89:18
   |
89 |     pub fn sheet<S: SheetMetadata>(&self, sheet_metadata: S) -> Result<Sheet<'i, S>> {
   |                     ^^^^^^^^^^^^^ required by this bound in `Excel::<'i>::sheet`

For more information about this error, try `rustc --explain E0277`.

Is this a known problem?

@ackwell
Copy link
Owner

ackwell commented May 23, 2024

I can reproduce this, but absolutely no idea what's going on. Even checking out the repositories as of the original implementation of this (that was extensively tested), it's throwing the same issue.

I expect that it's boiling down to impl<S: MetadataAdapter> SheetMetadata for SheetType<S> not taking effect for some reason, but I've not been able to pin that down.


I don't really have the time / headspace to work out what's going on here, especially given that the generated sheets are incredibly outdated and soon to be replaced with exdschema.

For now, I expect you don't need every generated sheet under the sun (nor every field in every sheet) - I'd recommend implementing SheetMetadata directly for the part(s) of the struct you do need.

@IAMSolaara
Copy link
Author

Sounds good to me. Closing the issue o7

@ackwell
Copy link
Owner

ackwell commented May 28, 2024

gonna reopen, sorry - will come back to this in future once schema stabilises a bit (no promises on timeline though)

@ackwell ackwell reopened this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants