Hello all,

I am a data center engineer of about 8 years now. I’ve spent the last 3 years or so slowly learning Python(I say slowly not because of my effort, but because learning Python was actually very difficult for me.) I am not an expert in any way shape or form, I understand the concepts of OOP, inheritance, classes, functions, methods, etc and I have found that the python documentation that can be found within the language is usually enough for me to be able to write the programs that I want to write. Very rarely have I had to write programs that have to bypass the GIL, but occasionally, I have created threadpools for applications that are not I/O intensive. What I’m saying is, for most things that I create, performance is enough with Python.

However, I have been inspired by how much love Rust is getting from the people who use Rust. I have tried to find some books for using Rust for network automation and unfortunately I have not been able to find any reputable books.

Most of the “automation” work that I do involves parsing data with regex, restructuring the data, converting the data into a modeled format and transforming something with that data. Does anyone have any common use cases for Rust that might interest me? Has anyone used Rust for network automation tools? With familiarity, can Rust’s intuitiveness match Python’s “from idea to deployment” speed? Or should I only learn Rust if I intend to create applications that need tight performance?

  • colonial@lemmy.world
    link
    fedilink
    arrow-up
    12
    ·
    edit-2
    10 months ago

    Rust would be an excellent fit for the type of work you describe. Assuming I understand the specifics correctly, the regex and serde crates would make the parsing + converting pretty effortless and fast.

    The language itself also works really well for “data pipeline” type programs, thanks to its FP features/iterators and type system.

    With familiarity, can Rust’s intuitiveness match Python’s “from idea to deployment” speed?

    Yes and no. For experienced developers, the total time from “start” to “finished product” is probably going to be about the same in both. It’s how that time is allocated that really distinguishes them.

    Rust is going to make you put in more work up front compared to Python: negotiating with the compiler, getting your types in order, that sort of thing. The benefit is that what comes out the other end tends to be baked all the way through - “if it compiles, it works.”

    Python, being a dynamic scripting language, is going to make it easier to get a vertical slice or minimum viable product up and running. But when/if you scale up, you have to pay that time back fixing problems that Rust’s static analysis could have caught at build time.

    TL;DR - Python is good for “throwing something together” or writing load-bearing scripts that do one simple thing really well. Rust is a slower start that shines as complexity and scale increase.