From 73eb78e3ac5eb7d382c1aca98da84cd866d54570 Mon Sep 17 00:00:00 2001 From: natrixaeria Date: Sat, 11 May 2019 06:26:26 +0200 Subject: Create a fundamental project structure --- game_server/src/group.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'game_server/src/group.rs') diff --git a/game_server/src/group.rs b/game_server/src/group.rs index 3241eee..9774979 100644 --- a/game_server/src/group.rs +++ b/game_server/src/group.rs @@ -1,7 +1,22 @@ -struct Group { - id: u32, +pub type GroupId = u32; + +pub struct Group { + id: GroupId, name: String, } impl Group { + pub(crate) fn new(id: GroupId, name: String) -> Group { + Group { id, name } + } + + pub(crate) fn get_id(&self) -> GroupId { + self.id + } + + pub fn run(&self) { + let id = self.id; + std::thread::spawn(move || + loop {println!("group id: {} meldet sich", id)}); + } } -- cgit v1.2.3-54-g00ecf