Can you verify my understanding of how Vec<T> resizes in memory?

I noticed that Vec capacity grows dynamically when pushing data.

Is my mental model accurate? When the buffer is full, does it allocate a new, larger memory region elsewhere on the heap, move the elements over, and free the old block specifically to avoid overwriting or corrupting adjacent heap data?

reddit.com
u/conceptcreatormiui — 6 days ago

Are methods associated functions behind the back?

number.max(othernumber) is similar to type::max(number, othernumber). Does the compiler infer methods as associated functions behind the back?

reddit.com
u/conceptcreatormiui — 22 days ago
▲ 26 r/rust

Learning rust: which syntax do you prefer?

let mut  longest: usize = 0; 

longest = usize::max(longest, (end - start) + 1); 

longest =  longest.max(end - start) + 1);

I prefer the first one because it is clear that it compares two usize type values. As a beginner the second one feels like it is out of place. It's like setting the parameter to be the max value.

I think a dot operator is better for this [made up] example:

number.add(3); 
// instead of 
type::add(number, 3);
reddit.com
u/conceptcreatormiui — 22 days ago
▲ 9 r/Kotlin

Hi Learning Kotlin, Can i use this rust pattern to abstract dealing with null values in my future projects?

sealed interface Option<out T> {
    data class Some<out T>(val value: T) : Option<T>
    data object None: Option<Nothing>
}

fun main(args: Array<String>) {
    val option: Option<String> = Option.None

    when (option) {
        is Option.None -> println("None")
        is Option.Some -> println(option.value)
    }
}
reddit.com
u/conceptcreatormiui — 1 month ago

Does Panasonic na-fd10x1hrm require high loop for draining?

I'm a filipino and we are very familiar with using a semi automatic washing machine and just recently upgraded to an automatic top load. Been using it for a while and since we do not have a drainage system for it since our old machine is outside our home, I decided to just punch a hole lower than the drain inlet. I just recently learned about high loop. But I assume that my new washer has an electronic shut to allow water to drain out when need since It is currently operating normally. So is high loop still necessary? If yes do I risk a flaw in its operation? The manual only tells not to place the drain pipe lower higher that the inlet but didn't mention a proper setup for it.

If I dont need to add a high loop setup can I atleast add a lower high loop to allow the water to drip down instead of it crawling in our outdoor drainage?

reddit.com
u/conceptcreatormiui — 2 months ago
▲ 6 r/gnome

A Personal Project: Attempt to make another desktop icon extension

This project is more of my personal project to work on just in my free time and yes I dont have to make another desktop icon extension but the track of this project is to make it as close to gnome shell native look with icons that move around when trying to move an icon. I mainly using "Adw.init()" to access the default adwaita looking widgets for gtk popover menu and I'm mainly referencing nautilus a lot. currently its just a preview. No drag and drop and other core operations yet but A partially working global menu is already in works. You can try out my development branch here. https://github.com/ochi12/shelled-desktop-icon/pull/1

u/conceptcreatormiui — 3 months ago