> For the complete documentation index, see [llms.txt](https://thryec.gitbook.io/dev-compedium/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thryec.gitbook.io/dev-compedium/near/rust-contracts/method-types.md).

# Method Types

#### Payable Methods&#x20;

* Methods can be annotated with `#[payable]` to allow tokens to be transferred with the method invocation.&#x20;

```rust
#[payable]
pub fn my_method(&mut self) {
...
}
```

#### Private Methods&#x20;

* Some methods need to be exposed to allow the contract to call a method on itself through a promise, but want to disallow any other contract to call it. For this, use the `#[private]` annotation to panic when this method is called externally.

```rust
#[private]
pub fn my_method(&mut self) {
...
}
```

#### Difference between pub fn and fn&#x20;

`pub fn` will be exported from the WASM so they can be called as part of a transaction. Otherwise it's just a helper function and not an entry point

#### Difference between private functions and fn&#x20;

`#[private]` is a special marker that's part of the `#[near_bindgen]` macro. You attach it to public functions, and it adds a restriction such that only the contract itself is allowed to call that function as part of a transaction, even though the function is public. `#[private]` technically creates a public entry point which only the contract itself is allowed to call. Useful for callbacks.
