Skip to content

set_rich_presence not work #114

Description

@colining

I'm not familiar with rust. but I do some test like this
and i found the code not work ,maybe some package should upgrade ,maybe other reason.

    #[test]
    fn it_works() {
        let value = Some("test");
        let a = value
            .and_then(|v| CString::new(v).ok())
            .map(|s| s.as_ptr() as *const _)
            .unwrap_or(std::ptr::null());
        let c: &CStr = unsafe { CStr::from_ptr(a) };
        println!("........{:#?}", c); 
       // it will print only .......
    }
    #[test]
    fn t_t() {
        let a = CString::new("tttt").unwrap_or_default();
        println!("........{:#?}", a);
        let b = a.as_ptr() as * const c_char;
        println!("........{:#?}", b);
        let c: &CStr = unsafe { CStr::from_ptr(b) };
        println!("........{:#?}", c);
        //it will print ......"test"
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions