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: pagination.rs
    path of file: ./repos/modelfox/crates/app/ui
    
    the code of the file until where you have to start completion: use modelfox_ui as ui;
use pinwheel::prelude::*;

pub struct Pagination {
	pub first_offset: Option<usize>,
	pub next_offset: Option<usize>,
	pub previous_offset: Option<usize>,
	pub last_offset: Option<usize>,
}

pub struct PaginationButtons {
	pub pagination: Pagination,
	pub form_action: Option<String>,
}

impl C
    
pub fn compute_pagination(offset: usize, n_items: usize, limit: usize) -> Pagination {
	let first_offset = if offset == 0 { None } else { Some(0) };
	let next_offset = if offset + limit < n_items {
		Some(offset + limit)
	} else {
		None
	};
	let previous_offset = if offset == 0 {
		None
	} else if offset < limit {
		Some(0)
	} else {
		Some(offset - limit)
	};
	let last_offset = n_items - limit;
	let last_offset = if offset >= last_offset {
		None
	} else {
		Some(last_offset)
	};
	Pagination {
		first_offset,
		next_offset,
		previous_offset,
		last_offset,
	}
}