-
Notifications
You must be signed in to change notification settings - Fork 12
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
"only-entities" feature? #38
Comments
ah. oh dear. I have two thoughts on this.
|
aaah, damnit. And these can (to my best knowledge) not be generalized easily so that we do not depend on tokio directly.
I think not. Well, maybe. The actual error on my side is compile_error!("Only features sync,macros,io-util,rt,time are supported on wasm.") when compiling my frontend code and pulling in tokio. I am not sure whether making tokio an optional dependency / making the crate general over executors would solve the issue in a nice way. Maybe that's even a bit orthogonal to my issue at hand. I have no strong feelings about that, but I think that it would be a better fix to do what you proposed in 2.
Yes, this is exactly what I had in mind, too. We could even make that change backwards-compatible by I will file a PR for that shortly. |
This patch move the entities module to a helper-crate. With this, we give the user the opportunity to use only the entities types in their codebase, if need be. One scenario where this is required came up in dscottboggs#38 TL;DR is: A user needed to be able to pass types like `Status` from a backend part of an application to a frontend which was compiled to WASM. Because mastodon_async depends on tokio, which does not compile to WASM (at least not with the features required by mastodon_async). One option would have been to provide types in the application code which can be constructed from mastodon_asyncs entity types. This would lead to _a lot_ of code duplication (over several projects still,... but that's rather undesireable anyways). The solution mastodon_async offers with this patch is a helper-crate which only contains the entity types: mastodon_async_entities. mastodon_async publicly exports the whole mastodon_async_entities crate, so users do not have to depend on the latter directly. In addition to the `entities` module from mastodon_async, also the `Visibility` type had to be moved. `mastodon_async_entities` also got an own `Error` type, which `mastodon_async::Error` can of course wrap. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Suggested-by: D. Scott Boggs <scott@tams.tech>
This patch move the entities module to a helper-crate. With this, we give the user the opportunity to use only the entities types in their codebase, if need be. One scenario where this is required came up in dscottboggs#38 TL;DR is: A user needed to be able to pass types like `Status` from a backend part of an application to a frontend which was compiled to WASM. Because mastodon_async depends on tokio, which does not compile to WASM (at least not with the features required by mastodon_async). One option would have been to provide types in the application code which can be constructed from mastodon_asyncs entity types. This would lead to _a lot_ of code duplication (over several projects still,... but that's rather undesireable anyways). The solution mastodon_async offers with this patch is a helper-crate which only contains the entity types: mastodon_async_entities. mastodon_async publicly exports the whole mastodon_async_entities crate, so users do not have to depend on the latter directly. In addition to the `entities` module from mastodon_async, also the `Visibility` type had to be moved. `mastodon_async_entities` also got an own `Error` type, which `mastodon_async::Error` can of course wrap. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Suggested-by: D. Scott Boggs <scott@tams.tech>
This patch move the entities module to a helper-crate. With this, we give the user the opportunity to use only the entities types in their codebase, if need be. One scenario where this is required came up in dscottboggs#38 TL;DR is: A user needed to be able to pass types like `Status` from a backend part of an application to a frontend which was compiled to WASM. Because mastodon_async depends on tokio, which does not compile to WASM (at least not with the features required by mastodon_async). One option would have been to provide types in the application code which can be constructed from mastodon_asyncs entity types. This would lead to _a lot_ of code duplication (over several projects still,... but that's rather undesireable anyways). The solution mastodon_async offers with this patch is a helper-crate which only contains the entity types: mastodon_async_entities. mastodon_async publicly exports the whole mastodon_async_entities crate, so users do not have to depend on the latter directly. In addition to the `entities` module from mastodon_async, also the `Visibility` type had to be moved. `mastodon_async_entities` also got an own `Error` type, which `mastodon_async::Error` can of course wrap. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Suggested-by: D. Scott Boggs <scott@tams.tech>
is this
referring to |
Yes, sorry for not being specific enough. |
This patch move the entities module to a helper-crate. With this, we give the user the opportunity to use only the entities types in their codebase, if need be. One scenario where this is required came up in dscottboggs#38 TL;DR is: A user needed to be able to pass types like `Status` from a backend part of an application to a frontend which was compiled to WASM. Because mastodon_async depends on tokio, which does not compile to WASM (at least not with the features required by mastodon_async). One option would have been to provide types in the application code which can be constructed from mastodon_asyncs entity types. This would lead to _a lot_ of code duplication (over several projects still,... but that's rather undesireable anyways). The solution mastodon_async offers with this patch is a helper-crate which only contains the entity types: mastodon_async_entities. mastodon_async publicly exports the whole mastodon_async_entities crate, so users do not have to depend on the latter directly. In addition to the `entities` module from mastodon_async, also the `Visibility` type had to be moved. `mastodon_async_entities` also got an own `Error` type, which `mastodon_async::Error` can of course wrap. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Suggested-by: D. Scott Boggs <scott@tams.tech>
Yeah, the looks like the problem is the |
This patch move the entities module to a helper-crate. With this, we give the user the opportunity to use only the entities types in their codebase, if need be. One scenario where this is required came up in dscottboggs#38 TL;DR is: A user needed to be able to pass types like `Status` from a backend part of an application to a frontend which was compiled to WASM. Because mastodon_async depends on tokio, which does not compile to WASM (at least not with the features required by mastodon_async). One option would have been to provide types in the application code which can be constructed from mastodon_asyncs entity types. This would lead to _a lot_ of code duplication (over several projects still,... but that's rather undesireable anyways). The solution mastodon_async offers with this patch is a helper-crate which only contains the entity types: mastodon_async_entities. mastodon_async publicly exports the whole mastodon_async_entities crate, so users do not have to depend on the latter directly. In addition to the `entities` module from mastodon_async, also the `Visibility` type had to be moved. `mastodon_async_entities` also got an own `Error` type, which `mastodon_async::Error` can of course wrap. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Suggested-by: D. Scott Boggs <scott@tams.tech>
This patch move the entities module to a helper-crate. With this, we give the user the opportunity to use only the entities types in their codebase, if need be. One scenario where this is required came up in #38 TL;DR is: A user needed to be able to pass types like `Status` from a backend part of an application to a frontend which was compiled to WASM. Because mastodon_async depends on tokio, which does not compile to WASM (at least not with the features required by mastodon_async). One option would have been to provide types in the application code which can be constructed from mastodon_asyncs entity types. This would lead to _a lot_ of code duplication (over several projects still,... but that's rather undesireable anyways). The solution mastodon_async offers with this patch is a helper-crate which only contains the entity types: mastodon_async_entities. mastodon_async publicly exports the whole mastodon_async_entities crate, so users do not have to depend on the latter directly. In addition to the `entities` module from mastodon_async, also the `Visibility` type had to be moved. `mastodon_async_entities` also got an own `Error` type, which `mastodon_async::Error` can of course wrap. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Suggested-by: D. Scott Boggs <scott@tams.tech>
I have a problem in my project... I need to pass data from
mastodon-async
to my frontend, which is compiled to WASM. For examplemastodon_async::entities::status::Status
.Compiling
mastodon-async
to WASM is not possible, because oftokio
, which cannot be compiled to WASM with the featuresmastodon-async
needs.I could, theoretically, copy all entity-types and add conversion from mastodon-async entity types to my own.
Another way would be to add a feature to
mastodon-async
for disabling everything except the entity types (which is the only thing I need to be able to pass them to the frontend). This way I could use the crate in my frontend only for the entity types.I know this is a niche issue, but I figured that asking would be better than copying about 500 LOC into my codebase.
Any thoughts on this?
The text was updated successfully, but these errors were encountered: