pub(crate) async fn room_load(&self, room_id: String) -> Result<Room<T>, WechatyError> {
        debug!("room_load(room_id = {})", room_id);
        if !self.is_logged_in() {
            return Err(WechatyError::NotLoggedIn);
        }
        let payload = self.rooms().get(&room_id).cloned();
        match payload {
            Some(payload) => Ok(Room::new(room_id.clone(), self.clone(), Some(payload))),
            None => {
                let mut room = Room::new(room_id.clone(), self.clone(), None);
                if let Err(e) = room.sync().await {
                    return Err(e);
                }
                Ok(room)
            }
        }
    }
/// Load a room.
///
/// Use room store first, if the room cannot be found in the local store,
/// try to fetch from the puppet instead.
Load a room.
Use room store first, if the room cannot be found in the local store,
try to fetch from the puppet instead.
Load a room . Use room store first if the room cannot be found in the local store try to fetch from the puppet instead .
pub(crate) async fn room_load(&self, room_id: String) -> Result<Room<T>, WechatyError> {
        debug!("room_load(room_id = {})", room_id);
        if !self.is_logged_in() {
            return Err(WechatyError::NotLoggedIn);
        }
        let payload = self.rooms().get(&room_id).cloned();
        match payload {
            Some(payload) => Ok(Room::new(room_id.clone(), self.clone(), Some(payload))),
            None => {
                let mut room = Room::new(room_id.clone(), self.clone(), None);
                if let Err(e) = room.sync().await {
                    return Err(e);
                }
                Ok(room)
            }
        }
    }
pub ( crate ) async fn room_load ( & self , room_id : String ) -> Result < Room < T > , WechatyError > { debug ! ( " " room_id ) ; if ! self . is_logged_in ( ) { return Err ( WechatyError :: NotLoggedIn ) ; } let payload = self . rooms ( ) . get ( & room_id ) . cloned ( ) ; match payload { Some ( payload ) => Ok ( Room :: new ( room_id . clone ( ) , self . clone ( ) , Some ( payload ) ) ) , None => { let mut room = Room :: new ( room_id . clone ( ) , self . clone ( ) , None ) ; if let Err ( e ) = room . sync ( ) . await { return Err ( e ) ; } Ok ( room ) } } }
Load a room.
Load a room .
&self
room_id
String
&self
room_id
String