Giter VIP home page Giter VIP logo

rust-memory-container-cs's Introduction

Rust Memory Container Cheat-sheet

Rust Memory Container Cheat-sheet

PNG Download table 📥

Dark/Low-contrast
Dark/Middle-contrast
Dark/High-contrast
Grey/Low-contrast
Grey/Middle-contrast
Grey/High-contrast
Light/Low-contrast
Light/Middle-contrast
Light/High-contrast
Black&White/Monochrome
White&Black/Monochrome

LICENSE ⚖️

Repos ⚙️

Contributors ❤

Author 🐇

Note for the next maintenance time

Workflow: How to export the variants?

  1. rust-memory-container-cs.pptx -> PowerPoint -> rust-memory-container-cs.svg (1280x720)
  2. rust-memory-container-cs.svg -> InkScape -> rust-memory-container-cs.png (3840x2160-dark-back)
  3. .png(3840x2160-dark-back) -> ImageMagick: ./generate-variants.sh
    1. -> {RESOLUTION}/rust-memory-container-cs-{RESOLUTION}-${SUFFIX}.png
      • ${RESOLUTION} = [ 3840x2160, 1920x1080, 1280x720 ]
      • ${SUFFIX}:
        • dark-back, dark-back-low-contrast, dark-back-high-contrast
        • light-back, light-back-low-contrast, light-back-high-contrast
        • grey, grey-back-low-contrast, grey-back-high-contrast
        • black-back-white-ink, white-back-black-ink

rust-memory-container-cs's People

Contributors

usagi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-memory-container-cs's Issues

Set classes in SVG and generate all variants with CSS

I would like to suggest the following, feel free to close if you don't want to follow this path.

  • picking SVG as the only source format (e.g. drop ppt), so there is no ambiguity what to edit
  • add class attribute to objects in SVG
  • use CSS to generate various variants

For example, this is the text node for one of the Type boxes. As you can see, I've added class="normal_label" attribute. You can do it directly in Inkscape as well.

<text               
   class="normal_label"
   inkscape:label="text125"
   fill="#bfbfbf"   
   font-family="Calibri, Calibri_MSFontService, sans-serif"
   font-weight="400"
   font-size="24px" 
   transform="translate(838.371,658)"
   id="text125">Type</text>

image

I can now create PDF or PNG directly from SVG on commandline with rsvg-convert from librsvg2-bin package (on Debian). For example

rsvg-convert -f pdf rust-memory-container-cs.svg > normal.pdf

will generate PDF as in SVG. So it will look like this
image

But CSS will allow to change attributes based on selectors, such as classes. So if red_labels.css looks like

.normal_label {
  fill: #ff0000;
}

and covert to pdf with

rsvg-convert -f pdf -s red_labels.css rust-memory-container-cs.svg > styled.pdf

image

Integral vs Integer

Towards the top of the image, one of the footnotes associates int with integral, which is incorrect when talking about the primitive datatype. See Rust By Example for instance.

image

Question about the multiple/unique branch

I love this project and I use it as wallpaper.
But I have a question about the multiple/unique branch. I feel this branch is unnecessay.
I feel Mutex should always be used inside Arc. Mutex are never used alone.
If there are any example where Mutex is needed in a single thread?

I'm new to Rust and I may confuse something.

Maybe add `AtomicRefCell`

While it's in a separate crate, AtomicRefCell seems like a very useful addition here as it expresses slightly different guarantees than Mutex / RWLock, and in the situations where it can be used it has a lot less overhead.

https://docs.rs/atomic_refcell

Question about the multiple/unique branch

I love this project and I use it as wallpaper.
But I have a question about the multiple/unique branch. I feel this branch is unnecessay.
I feel Mutex should always be used inside Arc. Mutex are never used alone.
If there are any example where Mutex is needed in a single thread?

I'm new to Rust and I may confuse something.

Include the useful suggestions from reddit

From: https://www.reddit.com/r/rust/comments/idwlqu/rust_memory_container_cheatsheet_publish_on_github/g2bsbso/?utm_source=reddit&utm_medium=web2x&context=3

Internal sharing? -[no]--> Allocates? -[no]--> Internal mutability? -[no]--> Ownership? -[no]-----------------------------------> &mut T
      \                     \                                    \                     `-[yes]----------------------------------> T
       \                     \                                    \
        \                     \                                    `-[yes]-> Thread-safe? -[no]--> Internal references? -[no]---> Cell<T>
         \                     \                                                       \                               `-[yes]--> RefCell<T>
          \                     \                                                       \
           \                     \                                                       `-[yes]-> Internal references? -[no]---> AtomicT
            \                     \                                                                                  \ `-[one]--> Mutex<T>
             \                     \                                                                                  `--[many]-> RwLock<T>
              \                     \
               \                     `-[yes]------------------------------------------------------------------------------------> Box<T>
                \         
                 `-[yes]-> Allocates? -[no]-------------------------------------------------------------------------------------> &T
                                    \
                                     `-[yes]-> Thread-safe? -[no]---------------------------------------------------------------> Rc<T>
                                                           `-[yes]--------------------------------------------------------------> Arc<T>
Reply

And, I have an interest to several suggestions for a correctness or details. But, the cheat-sheet favor to a newbiews, and the right columns is not a type, yes I know. I'll make an update with include these reddit users suggestions to the rev1 or a later.

Need better contrast

Nice reference! But it's problematic.

Rationale: A little-less-dark on dark background is never good usability.

I think all instances of text should have higher contrast ratios. See https://contrast-ratio.com/ for how this is calculated.

The text in the legend has contrast ratio of just 1.64
https://contrast-ratio.com/#rgb%2858%2C55%2C55%29-on-rgb%2813%2C13%2C13

The text in boxes contrast ratio is just 2.18
https://contrast-ratio.com/#rgb(110%2C105%2C105)-on-rgb(58%2C55%2C55)

This is very basic, but it needs to be emphasized: accessibility and usability matter. A lot.

2020-08-21_13-04-49

Consider avoiding `AtomicT` recommendation

See this discussion for context: rust-lang/rust-clippy#4295

Basically, AtomicT is not just “a fast Mutex<T>”, it has many additional properties such as it not supporting locking and it accepting Ordering parameters. It is often harmful to recommend AtomicT as a direct replacement for Mutex<T>, because people can easily make assumptions about how they behave that turn out to not be correct, since their actual behaviour is quite subtle (even just with SeqCst, the model of a Mutex<T> is far simpler as it allows arbitrary mutation while in the “locked” state). I see AtomicT as beïng a very low-level primitive for implementing concurrent data structures; it’s mostly too complex for high-level code. Generally, if someone understands Rust well enough to correctly know how to use atomics, they would not need this chart in the first place.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.