Can somebody show me a double linked list (or parent<->child relationship) in rust without unsafe code and without...

Can somebody show me a double linked list (or parentchild relationship) in rust without unsafe code and without reference counted types?

Attached: trans-crab.jpg (474x318, 15K)

Other urls found in this thread:

github.com/rust-lang/rust/blob/master/src/liballoc/collections/linked_list.rs
doc.rust-lang.org/std/pin/#example-intrusive-doubly-linked-list
twitter.com/NSFWRedditGif

No.
Use C++.

why yes
use std::collections::LinkedList;

let me guess... you live alone right?

What are you working on, fellow rustbros?

Attached: Screenshot from 2019-09-16 20-47-35.png (3840x2160, 573K)

Doesn't the implementation of that use unsafe code/reference counted types, also that wont work with parentchild relationship code, such as nodes/elements in games

Not entirely sure what you mean by parentchild relationship code. Do you mean self-referential struct?

Yes. Almost every internal function of LinkedList uses unsafe blocks.
github.com/rust-lang/rust/blob/master/src/liballoc/collections/linked_list.rs

>Almost every internal function of LinkedList uses unsafe blocks.
what's the fucking point of Rust then??!?

Yeah, directly or indirectly. It common for node structure such as in games with elements or in gui. So i was wondering if you can do it safely in rust without sacrificing performance more than you would in c++

Strawman,
Rust is a modern C with added type safety and many features. And it addresses many of C's mistakes.

The bottleneck in your GUI or Games usually come from other things, rather than linked list
doc.rust-lang.org/std/pin/#example-intrusive-doubly-linked-list

I know, but isn't rust supposed to be a replacement for c++? i would expect it to be better than c++ for basic tasks

Rust and (modern) C++ are pretty similar, actually. Both are pretty decent languages but also suffers from complexity. But since there's not overloading, inheritance and template meta-programming, Rust is more of a C's successor.

How come you keep suggesting C++ is better than Rust in context of a linked list?

I suppose concentrating all such uses into a well-tested standard library, while application code can make safe use of it.
As an example, implementations of the Java programming language often implement more features using native code and internal classes than strictly necessarily, and you can't write a C standard library in pure standard-conformant C either, even omitting the necessary glue code (for example, assembler code to invoke syscalls according to the SysV ABI) for a non-freestanding environment.

I think the grand scheme of OP's thread was to claim that Rust is bad because you can't have both safety and security.

It's a strawman, 99% of the time you can just use the linked list in the standard library and move on with more pressing programming problems. Since OP has none, he's now going to resort to ad hom or appeal to popularity.

Note that most of the C/C++ advocates don't know C/C++ very well themselves let alone how the C runtime works across the platforms.

The fucking crying about unsafe is so fucking retarded, its literally one fucking word.

How is GTK for Rust? Stable and has all the features of its "older"brothers?

Rust has a comprehensive gtk binding, a very well detailed and documented one as far as I can say.
Furthermore since GTK itself is mostly refcounted, the widgets themselves are refcounted too so the BC doesn't really get in your way with GUI.

I've been enjoying it, plus Rust is one of those languages that "click" with me (along with Nim, D and modern C++).

Overall, it's great.

>>It's a strawman, 99% of the time you can just use the linked list in the standard library and move on with more pressing programming problems. Since OP has none, he's now going to resort to ad hom or appeal to popularity.
>Note that most of the C/C++ advocates don't know C/C++ very well themselves let alone how the C runtime works across the platforms.
The irony. I never claimed rust is bad because you cant have both safety and security. Also i never said im a c/c++ advocate.
> 99% of the time you can just use the linked list in the standard library
You are assuming I would want linked lists for to use as a list, but i would use a vector for that. For the programming field im in, this type of data structure is written by yourself to reference to other data. It's not uncommon at all.
You are the one trying to read between the lines when there is nothing to be read. I was just curious if a common data structure can be done in idiomatic rust or if you have to depend on things that breaks what makes rust good

>Also i never said im a c/c++ advocate.
You seem to like C++ a lot, nothing wrong with modern C++ though.
>You are assuming I would want linked lists for to use as a list, but i would use a vector for that.
Maybe you misinterpreted me, if you need a linked list, 99% of the time you can just use the standard linked list is what I said. And you can have an intrusive doubly linked list with it without issues and using the standard implementation of linked list IS the idiomatic Rust.

Literally every compiler intrinsics, memory management, etc is unsafe.
You can't write Rust without any unsafe(including stdlib) on a machine that is fundamentally unsafe.

Lurk more retard.

>advocates for memory safety
>has unsafe code

fucking kill yourself retard

Do you, Rust people, unironically code in VS Code? For me, for modern C++, CLion is god-tier. I read somewhere that you can use Rust in CLion too, but via plugins

Attached: kitty-kitty.gif (500x413, 499K)

>without unsafe code
>without reference counted types
So you don't want to manage resources yourself, nor do you want to have the language manage those resources for you?
Fuck off.

Nothing wrong with VS Code as long as you dont have a shit tier PC

IntelliJ idea has an excellent plugin for Rust, but ultimately it all comes down to personal taste.
For C++ projects I just use Qt Creator because I like to avoid closed sources programs as much as convenient.

You have no idea what you are talking about. Learn safety principles retard.

>99% of the time you can just use the standard linked list
this ignores why people use these languages instead of writing everything in python or ruby

JetBrains have great Rust support in any of their IDEs.

see

>cnile stuck in an endless loop

IntelliJ Community Edition. Just search for the rust plug-ins.

Yeah, I'm using it.

top kek I get it now :D! It's "cnile" as in senile, except it includes the programming language name in it xD!!

Attached: 231gmn.jpg (394x291, 18K)

>all this garbage nonsense
Did you forget your \0 again?

Attached: 1566564228405_0.png (1799x825, 263K)

Now I only need to inquire how one derived "sepples" from "see-plus-plus", other than inaccurate pronunciation.

I actually use java :DD

Attached: hp11-intl-java-logo.jpg (420x280, 17K)

No, i wrote this while they were 4 beautiful blonde women standing naked behind me moaning

kek

>what's the fucking point of Rust then??!?
Wrapping that unsafe code in a safe interface on which the compiler will then enforce safe usage. Cope.

Attached: segfaulting cnile.png (627x722, 114K)