Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    Thats from diesel, i would suggest trying the diesel-rs/diesel gitter and https://github.com/diesel-rs/diesel/discussions/categories/q-a
    Piyush 🌱
    @shiftcommand_twitter
    Ahh of-course , Thank you 🙏
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    np, they are usually really good at helping out as Diesel can be a little complex ;)
    Piyush 🌱
    @shiftcommand_twitter
    I understand :)
    Proem Meas
    @measproem

    Dear All,
    I am new on Rust, I want using Serde Destabilize struct that contain field uuid (byte) any help to archive that

    `pub fn decode_serde<'de, T, R>(r: R) -> io::Result<T>
    where
        T: Deserialize<'de>,
        R: io::Read,
    {
        Deserialize::deserialize(&mut Deserializer::new(r)).map_err(map_err_to_io)
    }`

    With Deserialize::deserialize can modified to support uuid ?

    tanriol
    @tanriol:matrix.org
    [m]
    What do you mean by field uuid?
    Proem Meas
    @measproem
    Let me quick explain my case, I am using Actix web framework, by connect to database Tarantool, assume tble_user fields id(uuid), first_name, last_name,email. After I execute query select the result response need to use Serde Deserialize to my Struct all field success except field id contain data type uuid can't deserialize
    I am using this crate :https://github.com/zheludkovm/RustyTarantool/blob/master/src/tarantool/tools.rs#L24
    tanriol
    @tanriol:matrix.org
    [m]
    Do you mean Uuid from the uuid crate? Do you need some specific way of storing it in the table?
    Have you enabled the uuid's serde feature?
    Proem Meas
    @measproem
    Yes, I am using Uuid from uuid crate . I want the result from database deserialize to my struct by support uuid
    Yes uuid's serde feature
    tanriol
    @tanriol:matrix.org
    [m]
    Sounds like you may need this, not sure exactly... you may need to experiment a bit.
    1 reply
    Proem Meas
    @measproem
    I googled saw that but I didn't find sample code #[serde(with)]
    tanriol
    @tanriol:matrix.org
    [m]
    Something like #[serde(with = "uuid::serde::compact")] specified for that specific field, I think.
    Proem Meas
    @measproem
    image.png
    Not found uuid::serde::compact
    Proem Meas
    @measproem

    Hi all how can I access data Struck in Vec

    pub struct UserLoginTokenInfo{
        pub user_name: String,
        pub login_session: String,
    }
    pub struct UserLoginResponse {
        pub responsedlogin: Vec<UserLoginTokenInfo>,
    }

    I want get value user_name, login_session UserLoginResponse

    6 replies
    kushudai
    @kushudai
    Hello, I found a lot of github issues about this from 2015 but they seem all resolved. I also see the RFC that should prevent this but as far as I can tell, on stable 1.64 I can compile code that leaks a private type when it is returned from or a parameter to a function defined in a public trait.
    Perhaps I am simply misunderstanding...
    Here is an example that I think should not compile https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0280d55b3d6bb68aeb450608c8f115af
    2 replies
    tanriol
    @tanriol:matrix.org
    [m]
    @kushudai: IIUC, this is expected as your type is marked pub so it's public despite being in a private module. If you mark it pub(crate) instead, you'll see a privacy error.
    4 replies
    chaosprint
    @chaosprint:matrix.org
    [m]
    quick question: why in Rust 2021, I still need this extern crate?
    tanriol
    @tanriol:matrix.org
    [m]
    It would be problematic to automagically pull in alloc in no_std environment without memory allocation, IIUC. There's a bit of discussion in rust-lang/rust#90507
    1 reply
    slby
    @slby:matrix.org
    [m]
    Is there an equivalent to this in tokio? smol::io::BufReader::new(smol::Unblock::new(reader))
    Марго
    @Margosha555
    Привет всем, я ищу старшего разработчика Rust, мне нужен опытный сеньор, за пределами РФ
    Опыт работы в C++ более 3 лет
    Rust от 1 года
    Опыт работы в блокчейне от 1 года
    tanriol
    @tanriol:matrix.org
    [m]
    <del>Удачи в поисках :-) вообще эта комната не очень активна, но вдруг повезёт.</del>
    On the second glance, I'd note that this it not a Russian-language room, so you may have posted this to the wrong toom.
    Indoood
    @indoood
    Hey everyone. I'm trying to make a library that serializes things using serde but I'd like better type-safety. Specifically: the format is much more restrictive than serde and I'd like field types incompatible with my format to be rejected at compile-time. I'd also like to have a separate trait/derive macro for this. Is there a good example of this or something similar being done in a crate somewhere?
    chaosprint
    @chaosprint:matrix.org
    [m]
    Hi, is it possible to chain method that does not return a Self?
    1 reply
    peckpeck
    @peckpeck
    yes, they would however be methods of different structs
    obj.methodA().methodB() works if methodB is defined on the return type of methodA
    Nacho Castillo
    @nachocodexx
    Hi, someone knows why sha2 crate autocompletion is not working ?
    image.png
    Sorry I know that this channel is not the RustCrypto but I could not find it, so I decide to post my doubt here.
    Nacho Castillo
    @nachocodexx
    :/ someone to help with the problem I described above.
    2 replies
    Evgeny Igumnov
    @evgenyigumnov
    Hello all! Simple question. I using Idea Rust plugin. It is awfully. A lot of time this IDE don not highlight my mistakes in code. Only after compilation I will know my code problems! Whats the best IDE for Rust? My simple question! Thank you for your advice .
    xiretza
    @xiretza:xiretza.xyz
    [m]
    thanks to the Language Server Protocol (and rust-analyzer in particular), you can use pretty much any modern IDE/advanced editor and get great rust support - personally I use neovim, but there are also a lot of people using plain vim, emacs or VSCode. Just make sure whatever you choose supports LSP.
    Evgeny Igumnov
    @evgenyigumnov
    Intellegent Idea do not support LSP ?
    xiretza
    @xiretza:xiretza.xyz
    [m]
    no, it doesn't seem to
    Evgeny Igumnov
    @evgenyigumnov
    I need visual studio... I will try it ) thanks
    xiretza
    @xiretza:xiretza.xyz
    [m]
    there's also Helix, an editor written in Rust :)
    Evgeny Igumnov
    @evgenyigumnov
    I do not like vi based editors
    For me enough Far Manager Editor or Midnight Commander Editor )
    Johannes Altmanninger
    @krobelus

    This program

    struct Foo {
        someString: String,
    }
    fn main() {
        let x: Vec<Foo> = Vec::new();
        x.sort_by_key(|foo| &foo.someString);
    }

    does not compile because

    lifetime may not live long enough
    returning this value requires that `'1` must outlive `'2`

    I guess I should use x.sort_by() instead in this case

    Denis Lisov
    @tanriol
    @krobelus Yeah, there's an issue about that (rust-lang/rust#34162)
    copoer
    @copoer:ooper.space
    [m]
    Howdy, Does anyone know a good room to discuss rust-bert related topics?
    peckpeck
    @peckpeck
    what is rust-bert ?
    copoer
    @copoer:ooper.space
    [m]
    Viktor Gal
    @vigsterkr

    does anybody know why cargo publish ignores the actual value of CARGO_PKG_VERSION? i'm overriding the pkg version in build.rs for a project using:

    println!("cargo:rustc-env=CARGO_PKG_VERSION=1.1.1");

    but cargo publish seems to ignore that version and goes with the version in Cargo.toml. note in case of cargo build this is not the case.

    elmeri
    @elmeri15391352_twitter

    yooo! Is there any way to extract the "index" (order of occurrence) of a struct field in a macro like this:

    macro_rules! example {
        (struct $name:ident {
             $($field_name:ident: $field_type:ty,)*
        }) => {
            struct $name {
                $($field_name: $field_type,)*
            }
        }
    }

    such that

    example! {
        struct Struct {
            a: i32,
            b: i32,
        }
    }

    would have the index 0 associated to a and 1 to b etc. (for use in a particular impl)? =)

    1 reply
    peckpeck
    @peckpeck
    i don't think so