소스 검색

lang: rename loader_account.rs to account_loader.rs (#1279)

Paul 3 년 전
부모
커밋
0dfed11eaa
6개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. 2 1
      CHANGELOG.md
  2. 0 0
      lang/src/accounts/account_loader.rs
  3. 1 1
      lang/src/accounts/mod.rs
  4. 1 1
      lang/src/lib.rs
  5. 3 3
      lang/syn/src/lib.rs
  6. 3 3
      lang/syn/src/parser/accounts/mod.rs

+ 2 - 1
CHANGELOG.md

@@ -13,13 +13,14 @@ incremented for features.
 
 ### Breaking
 
+* lang: rename `loader_account` module to `account_loader` module ([#1279](https://github.com/project-serum/anchor/pull/1279))
 * ts: `Coder` is now an interface and the existing class has been renamed to `BorshCoder`. This change allows the generation of Anchor clients for non anchor programs  ([#1259](https://github.com/project-serum/anchor/pull/1259/files)).
 
 ## [0.20.1] - 2022-01-09
 
 ### Fixes
 
-*lang: Improved error msgs when required programs are missing when using the `init` constraint([#1257](https://github.com/project-serum/anchor/pull/1257))
+* lang: Improved error msgs when required programs are missing when using the `init` constraint([#1257](https://github.com/project-serum/anchor/pull/1257))
 
 ### Features
 

+ 0 - 0
lang/src/accounts/loader_account.rs → lang/src/accounts/account_loader.rs


+ 1 - 1
lang/src/accounts/mod.rs

@@ -2,6 +2,7 @@
 
 pub mod account;
 pub mod account_info;
+pub mod account_loader;
 pub mod boxed;
 #[doc(hidden)]
 #[allow(deprecated)]
@@ -12,7 +13,6 @@ pub mod cpi_state;
 #[doc(hidden)]
 #[allow(deprecated)]
 pub mod loader;
-pub mod loader_account;
 pub mod program;
 #[doc(hidden)]
 #[allow(deprecated)]

+ 1 - 1
lang/src/lib.rs

@@ -235,7 +235,7 @@ where
 pub mod prelude {
     pub use super::{
         access_control, account, accounts::account::Account,
-        accounts::loader_account::AccountLoader, accounts::program::Program,
+        accounts::account_loader::AccountLoader, accounts::program::Program,
         accounts::signer::Signer, accounts::system_account::SystemAccount,
         accounts::sysvar::Sysvar, accounts::unchecked_account::UncheckedAccount, constant,
         context::Context, context::CpiContext, declare_id, emit, error, event, interface, program,

+ 3 - 3
lang/syn/src/lib.rs

@@ -294,7 +294,7 @@ impl Field {
                 anchor_lang::accounts::account::Account
             },
             Ty::AccountLoader(_) => quote! {
-                anchor_lang::accounts::loader_account::AccountLoader
+                anchor_lang::accounts::account_loader::AccountLoader
             },
             Ty::Loader(_) => quote! {
                 anchor_lang::accounts::loader::Loader
@@ -414,7 +414,7 @@ pub enum Ty {
     CpiState(CpiStateTy),
     ProgramAccount(ProgramAccountTy),
     Loader(LoaderTy),
-    AccountLoader(LoaderAccountTy),
+    AccountLoader(AccountLoaderTy),
     CpiAccount(CpiAccountTy),
     Sysvar(SysvarTy),
     Account(AccountTy),
@@ -461,7 +461,7 @@ pub struct CpiAccountTy {
 }
 
 #[derive(Debug, PartialEq)]
-pub struct LoaderAccountTy {
+pub struct AccountLoaderTy {
     // The struct type of the account.
     pub account_type_path: TypePath,
 }

+ 3 - 3
lang/syn/src/parser/accounts/mod.rs

@@ -160,7 +160,7 @@ fn parse_ty(f: &syn::Field) -> ParseResult<Ty> {
         "AccountInfo" => Ty::AccountInfo,
         "UncheckedAccount" => Ty::UncheckedAccount,
         "Loader" => Ty::Loader(parse_program_account_zero_copy(&path)?),
-        "AccountLoader" => Ty::AccountLoader(parse_program_loader_account(&path)?),
+        "AccountLoader" => Ty::AccountLoader(parse_program_account_loader(&path)?),
         "Account" => Ty::Account(parse_account_ty(&path)?),
         "Program" => Ty::Program(parse_program_ty(&path)?),
         "Signer" => Ty::Signer,
@@ -229,9 +229,9 @@ fn parse_program_account_zero_copy(path: &syn::Path) -> ParseResult<LoaderTy> {
         account_type_path: account_ident,
     })
 }
-fn parse_program_loader_account(path: &syn::Path) -> ParseResult<LoaderAccountTy> {
+fn parse_program_account_loader(path: &syn::Path) -> ParseResult<AccountLoaderTy> {
     let account_ident = parse_account(path)?;
-    Ok(LoaderAccountTy {
+    Ok(AccountLoaderTy {
         account_type_path: account_ident,
     })
 }