How to build crate

i just build a simple lib, how to convert it into crate and publish

On the crates.io homepage there's a drop-down menu called "Docs". You're probably looking for the Publishing on crates.io link.

is it required github account ? what about gitlab

This question has also been asked here:

You can store your code on GitLab, but you have to have a GitHub account to log in on crates.io website.

i build a simple rust library for checking error during user input
Cargo.toml
[dependencies]
userinput = {git = "https://github.com/carnot-engine/userinput.git"}

sample:

fn main() {
println!("Hello, world!");
println!("Enter the char");
let ch = userinput::char();
}

have a try

let var = userinput::datatype();

can any one help me with documentation

Use cargo doc to generate documentation yourself based on /// comments. It's in target/docs and you can upload it somewhere.

If you publish your create on crates.io, you will get documentation automatically on docs.rs