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

List的API修改 #7

Open
fandahao17 opened this issue Jun 26, 2019 · 0 comments
Open

List的API修改 #7

fandahao17 opened this issue Jun 26, 2019 · 0 comments

Comments

@fandahao17
Copy link
Contributor

fandahao17 commented Jun 26, 2019

我们之前的list是用Vector实现的,使用起来有很多不便,所以我们对list模块进行了重写,实现了FreeRTOS里的链表结构。此外,list中的宏被改成了函数,这样可以让编译器生成更友好的报错信息。

为了保持一致性,list的函数声明修改很小,主要是要注意使用时要加上命名空间(用list::list_insert(...)的方式而不是use crate::list::*)还有一部分函数的参数变为了引用

其余API修改如下:

  1. 为了更好的封装智能指针,List结构和ListItem结构被ListLinkItemLink替代,实例化时直接用对应类型的default()方法即可(List创建时不再使用add_list()),例如:
pub static ref DELAYED_TASK_LIST: ListLink = Default::default();
  1. set_list_item_container!()被废弃
  2. get_list!宏被删掉,使用链表时直接用链表名就可以了。
@fandahao17 fandahao17 changed the title List的API List的API修改 Jun 26, 2019
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

1 participant