Skip to content

Commit

Permalink
examples: add solana sdk examples
Browse files Browse the repository at this point in the history
Change-Id: I2f0cc982c880ba1830ad1e1c4a4a409876c4ad66
  • Loading branch information
Reisen committed Jan 14, 2022
1 parent 7f1c7ec commit ca1f026
Show file tree
Hide file tree
Showing 10 changed files with 4,305 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/messenger/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "wormhole-messenger-common"
version = "0.1.0"
edition = "2018"

[lib]
name = "messenger_common"
crate-type = ["cdylib", "lib"]

[dependencies]
borsh = "0.8.1"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
13 changes: 13 additions & 0 deletions examples/messenger/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use borsh::{
BorshDeserialize,
BorshSerialize,
};

#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, PartialEq)]
pub struct Message {
/// Messenger/DM username.
pub nick: String,

/// Message text to be output on the target networks node logs.
pub text: String,
}
21 changes: 21 additions & 0 deletions examples/messenger/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Uses 2018 for maximum compatibiilty with Solana.
edition = "2018"

# Merge similar crates together to avoid multiple use statements.
imports_granularity = "Module"

# Consistency in formatting makes tool based searching/editing better.
empty_item_single_line = false

# Easier editing when arbitrary mixed use statements do not collapse.
imports_layout = "Vertical"

# Default rustfmt formatting of match arms with branches is awful.
match_arm_leading_pipes = "Preserve"

# Align Fields
enum_discrim_align_threshold = 80
struct_field_align_threshold = 80

# Allow up to two blank lines for grouping.
blank_lines_upper_bound = 2
Loading

0 comments on commit ca1f026

Please sign in to comment.