Comments (2)
@telamon no worries, it's always okay to ask (:
Getting a better idea of what you're looking at would be helpful. I'm not sure what you're running into. Screenshots would be good, text output would be better, a git repo that can be cloned and run to reproduce your error would be best.
Thanks!
from hypercore.
@yoshuawuyts Thank you for the reply.
Sorry if my question was a bit unclear, essentially I'd like to know how to define a struct capable of holding a Feed or a method that could take a reference to a Feed.
Due to the design of the RandomAccess trait I cannot figure out how to declare my struct letalone define a variable that will be able to hold it without using the automatic type declaration.
Here is an example I ended up with following compiler errors:
use hypercore::Feed;
use random_access::RandomAccess;
use std::path::PathBuf;
#[test]
fn it_works() {
let storage_path = PathBuf::from("/tmp/a");
let mut feed: Feed<RandomAccess<Error = failure::Error>> = hypercore::Feed::new(&storage_path).unwrap();
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// I simply can't figure out the correct type format to satisfy the compiler.
}
The above snippet produces the following error:
Compiling ciphercore v0.1.0 (/home/telamon/lpro/hyper-rs/ciphercore)
error[E0277]: the size for values of type `dyn random_access_storage::RandomAccess<Error=failure::error::Error>` cannot be known at compilation time
--> tests/test.rs:10:19
|
10 | let mut feed: Feed<RandomAccess<Error = failure::Error>> = hypercore::Feed::new(&storage_path).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `dyn random_access_storage::RandomAccess<Error=failure::error::Error>`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `hypercore::Feed`
Omitting Error = failure::Error
as argument to RandomAccess<>
makes the compiler complain about a missing argument, just like omitting RandomAccess
from from Feed<>
produces the same compiler complaint.
Ultimately I would just like to define a struct with a feed...
pub struct MyStruct {
a_feed: ??Type??
}
from hypercore.
Related Issues (20)
- Change stack from `failure` to `std::error::Error` HOT 2
- Feed.put with data yields weird results HOT 3
- Dynamic dispatch for storage? HOT 5
- Plan 0.12 release HOT 7
- Building latest version fails HOT 4
- Running benchmarks fails HOT 2
- Read key pair from disk HOT 3
- 🙋 Android bindings HOT 16
- Upgrade sha2 to 0.8.x HOT 1
- Implement feed.audit() HOT 5
- Possible issue with signing data.
- refactor binary interface types from `usize` to their specific sizes HOT 2
- Remove Feed Builder in favor of Feed simple create function HOT 7
- update random-access-* HOT 2
- README is incorrect about what the sample code prints HOT 1
- Dependabot can't resolve your Rust dependency files
- How do I read an existing hypercore on disk? HOT 3
- Networking: NOISE handshake and transport encryption HOT 7
- Async API on hypercore HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hypercore.