Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Added Send+Sync to MutableBuffer #368

Merged
merged 1 commit into from
Sep 2, 2021
Merged

Added Send+Sync to MutableBuffer #368

merged 1 commit into from
Sep 2, 2021

Conversation

jorgecarleitao
Copy link
Owner

No description provided.

@jorgecarleitao jorgecarleitao added the enhancement An improvement to an existing feature label Sep 2, 2021
@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #368 (ec1462f) into main (cef5f08) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #368   +/-   ##
=======================================
  Coverage   81.05%   81.05%           
=======================================
  Files         326      326           
  Lines       21103    21103           
=======================================
  Hits        17105    17105           
  Misses       3998     3998           
Impacted Files Coverage Δ
src/buffer/mutable.rs 88.29% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cef5f08...ec1462f. Read the comment docs.

@sundy-li
Copy link
Collaborator

sundy-li commented Sep 2, 2021

Why MutableBuffer is Sync? There are lots of methods inside that are not sync.

I get it now.

@jorgecarleitao
Copy link
Owner Author

jorgecarleitao commented Sep 2, 2021

Why MutableBuffer is Sync? There are lots of methods inside that are not sync.

Implementing Sync means that a type guarantees that references to its values can be shared between threads, without risk of a data race in safe Rust.

Values of type &MutableBuffer<T> are immutable and it is thus safe to share them.

In essence, it is the same reason why Vec<T> is Sync iff T is Sync.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement An improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants