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

pathfinder_export is not on crates.io #521

Open
asattely opened this issue Aug 27, 2022 · 10 comments
Open

pathfinder_export is not on crates.io #521

asattely opened this issue Aug 27, 2022 · 10 comments

Comments

@asattely
Copy link

I'm a little new to the whole rust ecosystem, so please forgive me if this is a dumb thing to report. I was able to find all of the modular crates on crates.io that I tried except for pathfinder_export. Is there an easy way to use it in my project without downloading the whole master branch and using it locally?

@s3bk
Copy link
Collaborator

s3bk commented Aug 27, 2022

You can use

pathfinder_export = { git = "https://github.com/servo/pathfinder" }

@asattely
Copy link
Author

I've done that and for some reason it's saying that the Scene object I've created is of a different type, since the git version seems to be interacting with a different definition of 'Scene' than the crates.io version:
image

Could be wrong about that though. I am using renderer 0.5.0, which seems to be the newest as far as I'm aware.

@asattely
Copy link
Author

Using this dependencies section in my cargo.toml:

[dependencies]
gcd = "2.1.0"
bitflags = "1.2.1"
rustc-hash = "1.1.0"
font-kit = "0.6"

pathfinder_canvas = { features = ["pf-text"], version = "0.5" }
pathfinder_geometry = { version = "0.5" }
pathfinder_renderer = { version = "0.5" }
pathfinder_resources = { version = "0.5" }
pathfinder_export = { git = "https://github.com/servo/pathfinder", version = "0.1" }

@s3bk
Copy link
Collaborator

s3bk commented Aug 28, 2022

Yes, it can get quite messy.
I use all git dependencies but the internally reference crates.io versions, so it needs a patch section with a few entries:

[patch.crates-io]
pathfinder_geometry = { git = "https://github.com/servo/pathfinder" }
pathfinder_renderer = { git = "https://github.com/servo/pathfinder" }
...

@asattely
Copy link
Author

Thank you! I added that to the end of my Cargo.toml and it solved the issue for me. Thanks a lot for your help, and sorry for the unnecessary issue opening.

@Tails
Copy link
Contributor

Tails commented Oct 19, 2022

@asattely could you post the complete Cargo.toml that worked for you? I'm trying the patch but I'm still getting the same Scene error. Here is mine:

pathfinder_canvas = { version="0.5", features=["pf-text"] }
pathfinder_geometry = "0.5"
pathfinder_content  = "0.5"
pathfinder_renderer  = "0.5"
pathfinder_export  = {git = "https://github.com/servo/pathfinder"}

hex_color = "2"
csscolorparser = "0.6.2"
async-channel = "1.7.1"
tokio = { version="1", features = ["full"] }

[patch.crates-io]
pathfinder_geometry = { git = "https://github.com/servo/pathfinder" }
pathfinder_renderer = { git = "https://github.com/servo/pathfinder" }
pathfinder_content = { git = "https://github.com/servo/pathfinder" }

And the error:

error[E0277]: the trait bound `Scene: pathfinder_export::Export` is not satisfied
wasmedge_1  |   --> lib/partage_prerendering/src/canvas/pathfinder.rs:39:13
wasmedge_1  |    |
wasmedge_1  | 38 |         Ok(pathfinder_export::Export::export(
wasmedge_1  |    |            --------------------------------- required by a bound introduced by this call
wasmedge_1  | 39 |             &scene,
wasmedge_1  |    |             ^^^^^^ the trait `pathfinder_export::Export` is not implemented for `Scene`
wasmedge_1  |    |
wasmedge_1  |    = help: the trait `pathfinder_export::Export` is implemented for `pathfinder_renderer::scene::Scene`

@s3bk
Copy link
Collaborator

s3bk commented Oct 19, 2022

You at least need to add pathfinder_gpu as well. And then all other pathfinder crates that show up twice in cargo.lock.

@Tails
Copy link
Contributor

Tails commented Oct 19, 2022

Thanks for your reply. So, add all the pathfinder_ crates to the [patch.crates-io] list, not as a straight dependency?

@s3bk
Copy link
Collaborator

s3bk commented Oct 19, 2022

Yes.

@Tails
Copy link
Contributor

Tails commented Oct 19, 2022

For future reference, make sure the following section is defined in the project's workspace root:

[patch.crates-io]
pathfinder_geometry = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_canvas = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_renderer = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_content = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_simd = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_gl = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_webgl = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_gpu = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_resources = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_color = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_lottie = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_magicleap_demo = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_ui = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_svg = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_metal = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_swf = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_text = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }
pathfinder_web_canvas = { commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder" }

And the sub-crate defines the deps as normally:

pathfinder_canvas = { version="0.5", features=["pf-text"] }
pathfinder_geometry = "0.5.1"
pathfinder_content = "0.5"
pathfinder_renderer = "0.5"
pathfinder_export = {commit="9e0331742dedfed41d9e7791a9afbead0e0fbcd5", git = "https://github.com/servo/pathfinder"}

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

3 participants