use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod myepicproject {
use super::*;
pub fn start_stuff_off(ctx: Context<StartStuffOff>) -> ProgramResult {
Ok(())
}
}
#[derive(Accounts)]
pub struct StartStuffOff {}
i我有上面的源锈蚀代码,下面的错误。
error[E0412]: cannot find type `ProgramResult` in this scope
--> programs/myepicproject/src/lib.rs:8:58
|
8 | pub fn start_stuff_off(ctx: Context<StartStuffOff>) -> ProgramResult {
| ^^^^^^^^^^^^^ not found in this scope
For more information about this error, try `rustc --explain E0412`.
error: could not compile `myepicproject` due to previous error
这解决了这个问题。您必须明确导入IT
try这样:
pub fn start_stuff_off(ctx: Context<StartStuffOff>) -> Result<()> {
trone结果
为程序恢复原因, ProgramResult是已在较旧的锚点项目中使用的类型别名,在较新的锚定版本中,IT支持错误处理的结果,结果约定也将删除从您的项目中导入的不必要的库。