Rust SDK
Rust SDK reference documentation.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
The Rust SDK for building smart contracts.
#[near(contract_state)]
pub struct Contract {
greeting: String,
}
impl Default for Contract {
fn default() -> Self {
Self { greeting: "Hello".to_string(), }
}
}
#[near]
impl Contract {
pub fn get_greeting(&self) -> String {
self.greeting.clone()
}
pub fn set_greeting(&mut self, greeting: String) {
self.greeting = greeting;
}
}
Was this page helpful?