Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    VinothKumar Raman
    @eventaken_twitter
    It was complaining that I cannot implement Add since its not in my crate
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    thats correct thats not possible
    VinothKumar Raman
    @eventaken_twitter
    Is there any other way I can overload + for this?
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    I tend to use a wrapper trait to do similar things
    VinothKumar Raman
    @eventaken_twitter
    How do you do that?
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    will have to try it out its a long time since i did last,
    VinothKumar Raman
    @eventaken_twitter
    Oh okay I will search for it, but thanks for the hint
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    what crate is Add from? will give you a hand as soon as i have fed my daughter XD
    VinothKumar Raman
    @eventaken_twitter
    @KatsuoRyuu I figured what you meant by wrapper
    I defined,
    struct Indicator<In, Transducer, Out> {
        input: PhantomData<In>,
        output: PhantomData<Out>,
        processor: Transducer
    }
    and Transducer as the original Indicator. I suppose every problem can indeed be solved with another level of indirection
    BTW, Add is from standard library
    That's the way you overload the operator +
    But thanks for the hint
    Anders Blenstrup-Pedersen
    @KatsuoRyuu
    yes correct, sorry if i was not clear on it ;)
    Piyush 🌱
    @shiftcommand_twitter
    Hello Everyone , I have been trying to learn Rust / Diesel and have taken up some pet project to do so. I was trying to convert the following to Diesel , currently I am clueless can someone please point me to a direction ?
    select p.id,name, gender, p.email, phone, age, photo , industry, tags, country , area, twitter, user_list_id from people  
    as p left join
    (
        select * from list_people lp 
            inner join user_list ul on lp.user_list_id = ul.id 
            inner join users u on ul.user_id = u.id  
            where u.id = 1
    ) g on p.id = g.people_id
    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 :)
    alexchole
    @alexchole:matrix.org
    [m]
    "I'll help 10individuals how to earn $30,000 in 72 hours from the crypto market. But you will pay me 10% commission when you receive your profit. if interested send me a direct message on Telegram by asking me (HOW) for more details on how to get started
    https://t.me/+lD4Ec_gRjCljYjNk
    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