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

"Mutex" Trait based API #15

Closed
vitiral opened this issue Jun 16, 2017 · 2 comments
Closed

"Mutex" Trait based API #15

vitiral opened this issue Jun 16, 2017 · 2 comments

Comments

@vitiral
Copy link

vitiral commented Jun 16, 2017

This is a counter proposal to #14 and aims to be simpler and more future proof.

I have sketched out an implementation which compiles (but is not tested) here:

https://github.com/vitiral/utex/blob/master/src/lib.rs

Reason of need

The embedded ecosystem is very likely to have multiple ways of allocating data, from statically to managed-static to full dynamic. However, most libraries should not care who allocated data -- only that it will not get freed and is not being used by others.

Therefore there is a strong need for a single trait that all of these libraries can use for wrapping the data they return.

Issue at Hand

The existing Buffer API will tie us to the following:

  • a specific buffer type and way of representing data
  • a lock/unlocking mechanism that can not be easily extended by other crates. For instance, it would be difficult to implement a memory manager using the Buffer API

This design aims to address this by providing a Mutex trait which can then be implemented in any way we please. Something like the Buffer proposed would be free to implement this trait and then be used for the full API.

@japaric
Copy link
Member

japaric commented Feb 14, 2018

I'm closing this since #13 was also closed

@japaric japaric closed this as completed Feb 14, 2018
@vitiral
Copy link
Author

vitiral commented Feb 15, 2018

sorry, I should have closed this before. Thanks!

peckpeck pushed a commit to peckpeck/embedded-hal that referenced this issue Nov 10, 2022
15: Release new patch on crates.io with minimised i2c dependencies r=therealprof a=ryankurte

Following rust-embedded#14 this release contains a newer version of the i2cdev crate that decreases the number of dependencies and thus build time (measured on an rpi3 from 1hr 20 mins to 20 mins).

Co-authored-by: Ryan Kurte <ryankurte@gmail.com>
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