[Solved] Proper way to access Vec as strings [duplicate]

Because r is an array of u8, you need to convert it to a valid &str and use push_str method of String. use std::str; fn main() { let rfrce = vec![&[65,66,67], &[68,69,70]]; let mut str = String::new(); for r in rfrce { str.push_str(str::from_utf8(r).unwrap()); } println!(“{}”, str); } Rust Playground 3 solved Proper way to access … Read more

[Solved] Use of undeclared type that is defined in another file

This is documented in the Rust book, specifically the section on modules. When you have different modules, you need to bring items from the other modules into scope using the use keyword. mod query { pub struct Query; } // Bring Query into scope use query::Query; struct Row(Vec<Query>); fn main() {} solved Use of undeclared … Read more

[Solved] Trying to get Rust to load files

The best way to fix this is to rename the manifest file to mod.rs and change the first line in main.rs to: mod lib; and change mod.rs to: pub mod structs { mod entity; } I think the reason for your error is because there’s a manifest.rs file but no folder. Why this causes the … Read more

[Solved] Solana CPI (runtime) invoke fails when creating a new account by system_instruction::create_account (on-chain program with anchor framework)

I realized the issue: I did not pass the system_program into instruction. pub system_program: Program<‘info, System> Need to use invoke_signed to also let pda to sign invoke_signed( &create_acc_ix, &[ self.minter.clone(), self.mint_pda_acc.clone(), ], &[&[ &mint_seed.as_ref(), &[*bump_seed] ]] )?; solved Solana CPI (runtime) invoke fails when creating a new account by system_instruction::create_account (on-chain program with anchor framework)