All separable zero-dimensional metric spaces can be embedded into the Cantor set In this question, the answerers prove that every separable zero-dimensional metric space can be topologically embedded into $\mathbb{N}^\mathbb{N}$, but I think more is true. I think I have a proof that a topological space can be topologically embedded into the Cantor set (or rather, its topological equivalent $\{0,1\}^\mathbb{N}$) if and only if it is a separable zero-dimensional metrizable space.
First every subspace of the Cantor set is clearly a separable zero-dimensional metrizable space. Conversely, let $X$ be any separable zero-dimensional metrizable space. Then $X$ has a basis consisting of clopen sets $\mathscr{B}$. Since $X$ is separable and metrizable, it is second-countable, so $\mathscr{B}$ has a countable subset $\{B_0,B_1,\ldots\}$ which is also a basis (see here or here).
Define a function $f:X\to\{0,1\}^\mathbb{N}$ by $f(x)=(a_i)_{i\in\mathbb{N}}$ where $a_i=1$ if and only if $x\in B_i$. To see that $f$ is continuous, it is sufficient to check product topology prebasis elements. Indeed, if $\pi_j:\{0,1\}^\mathbb{N}\to\{0,1\}$ is the $j$th projection map, then $f^{-1}(\pi_j^{-1}(\{1\}))=B_j$ and $f^{-1}(\pi_j^{-1}(\{0\}))=X\setminus B_j$ which are both open. Finally, to see that $f$ is a topological embedding, simply note that $f(B_j)=\pi_j^{-1}(\{1\})\cap f(X)$ which is open in $f(X)$.
My proof feels remarkably simpler than the ones I saw in the first question I linked, so I am left to wonder if I made an error somewhere. Additionally, being metrizable only seemed necessary in my proof to guarantee second-countability, so I think the "separable zero-dimensional metrizable" condition could be replaced with "second-countable zero-dimensional".
Is my reasoning correct?
 A: A second countable zero-dimensional Hausdorff space is metrisable and embeddable so it's not really a win in generality to replace separable metrisable zero-dimensional by that the former condition. The Hausdorff I added because it's needed anyway to embed into the (Hausdorff!) Cantor cube $\{0,1\}^{\Bbb N}$. You could even use the fact that a space as I described in the first line embeds into it (and so must be metrisable) as a proof for the first statement. 
The continuity of $f$ is clear because $\pi_n \circ f$ is just the characteristic function of a clopen set $B_n$ (so is continuous). $f$ is 1-1 and an embedding because the family of those characteristic functions separates point, and points and closed sets, which is the general argument for such a product map to be an embedding; no special need for a zero-dimensional version of the old argument. In your proof you don't mention (though it's true) that $f$ is 1-1. You should expand your argument why $f[B_j]= \pi_j^{-1}[\{1\}] \cap f[X]$ to have a full self-contained proof, not just claim it; it's not very hard though.
