However, to get it to work I had to ignore a warning:
C:\Users\pc\rust\flate3>cargo publish
Updating crates.io index
error: 2 files in the working directory contain changes that were not yet committed into git:
Cargo.toml
src\lib.rs
to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag
which I did. But I don't really understand what the warning means, or how I can avoid the warning.
What is going on here? ( Stupid question I am sure! )
The error message says that you had some changes that had not yet been committed to that repository. You can try the git diff command to see those changes.
Hmm, I would really prefer not to install git, unless it's really essential. I don't see why I would want to do that at all ( although maybe this is ignorance ).
Really, I think I am rather confused on what is actually going on here. Is the crate published at crates.io or github or both together or what? Everything does seem to be working, at least! Sorry for my ignorance and confusion.
crates.io is the easiest way for other Rust developers to use your crate. It's also required if you want to allow other packages on crates.io to depend on your library.
GitHub is useful for collaborative development. If you use git for version control, then GitHub provides various ways for you to keep your code in sync with other developers and merge your changes with theirs.
You currently need a GitHub account to log in to crates.io, but publishing your code there is not required. You can publish it to crates.io alone, if you choose.
Cargo assumes that everyone uses git. It has set up a local git repository for you when it created a new project. It's not required to use git, but it's such a popular option that it's enabled by default.
You've made more changes after you've uploaded the files. Cargo wants you to commit the most recent changes too (save them in the local repository). It's not required to upload them anywhere, just commit locally.
Yeah, I think I am starting to "grok" it, I tend to get a bit stressed when I don't really understand what is going on. Like I am being told to specify a "repository" and a "website" and I didn't know why I had to specify these things to use cargo publish, as they didn't seem logically necessary in my mental picture of what was happening - and actually I think my mental picture was right, but it was confusing.
In the end I don't think I specified all the things I was being told to, and I still don't know what happened with the website/homepage thing. I was like "eh? I don't have a website..., why would I need that".
where it implies a "homepage" is needed - but actually I haven't specified that.
As for the "git commit" thing, I think am just going to ignore it. The changes are on the git website, but I don't have git installed locally on my machine, and I have no plans to do that. Maybe there could be a little more documentation somewhere on the relationship between cargo and git, what is possible, what is required, and what the options are.
Perhaps not essential but using git offers great benefits for almost anything you do, publishing to crates.io or otherwise.
It need not be complicated either. Git is kind of huge and intimidating with a billion features. You will read all over the place about branching, merging, rebasing etc, etc. But typically I only use a handful of simple commands:
I find that even for small experimental codes once it's past a day or so's work it's worth stashing it in git and then github/bitbucket/local git repo.
It helps greatly keeping versions straight of course. But what I like is the way I can mash on code experimentally and if it turns out to be silly idea and everything is broken then "git checkout" and boom I'm back to my last know working state.
It helps greatly when I want quickly pull code to different machines/platforms and test it there. It's easy to move the code. It's easy to know all your copies everywhere are the same version.
All in all it's about organizing chaos and the peace of mind that brings. Rather like the type system and borrow checker in Rust. "Hack without fear" as someone said.