Skip to content

Conversation

@willemneal
Copy link
Member

Allows external interface to use values and then the internal contracttraits can use references.

#[contracttrait]
pub trait Foo {
     fn foo(e: &Env, s: &String);
}

// Generated exported methods will use value instead of reference

impl Contract {
  pub foo(e: &Env, s: String) {
      <Contarct as ContractTrait>::foo(e, &s)
  }

@willemneal willemneal force-pushed the feat/pass_references branch from 06e942b to 5ce40c8 Compare June 30, 2025 21:02
This creates a new <Contract>External contract struct which will allow the external methods to still have no references but then the generated code will pass by reference if the contracttrait requires it.
@willemneal willemneal force-pushed the feat/pass_references branch from 5ce40c8 to 4ecfd28 Compare June 30, 2025 21:03
@willemneal willemneal merged commit 59adf37 into main Jul 1, 2025
1 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant