You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cred.rs
    path of file: ./repos/gitui/src/components
    
    the code of the file until where you have to start completion: use anyhow::Result;
use crossterm::event::Event;
use ratatui::{layout::Rect, Frame};

use asyncgit::sync::cred::BasicAuthCredential;

use crate::app::Environment;
use crate::components::{EventState, InputType, TextInputComponent};
use crate::keys::key_match;
use crate::{
	components::{
		visibility_blocking, CommandBlocking, CommandIn
    
	fn event(&mut self, ev: &Event) -> Result<EventState> {
		if self.visible {
			if let Event::Key(e) = ev {
				if key_match(e, self.key_config.keys.exit_popup) {
					self.hide();
					return Ok(EventState::Consumed);
				}
				if self.input_username.event(ev)?.is_consumed()
					|| self.input_password.event(ev)?.is_consumed()
				{
					return Ok(EventState::Consumed);
				} else if key_match(e, self.key_config.keys.enter) {
					if self.input_username.is_visible() {
						self.cred = BasicAuthCredential::new(
							Some(
								self.input_username
									.get_text()
									.to_string(),
							),
							None,
						);
						self.input_username.hide();
						self.input_password.show()?;
					} else if self.input_password.is_visible() {
						self.cred = BasicAuthCredential::new(
							self.cred.username.clone(),
							Some(
								self.input_password
									.get_text()
									.to_string(),
							),
						);
						self.input_password.hide();
						self.input_password.clear();
						return Ok(EventState::NotConsumed);
					} else {
						self.hide();
					}
				}
			}
			return Ok(EventState::Consumed);
		}
		Ok(EventState::NotConsumed)
	}